def import_from_file(
    httpreq: Request,
    file: Annotated[UploadFile, File()],
    tags: Annotated[list[str], Form()],
) -> BulkObservableAddResponse:
    """Adds and returns observables from a given url, attempting to guess
    their types."""
    if file.size > MAX_FILE_UPLOAD:
        raise HTTPException(status_code=400, detail="File too large")
    try:
        # we can't use request.file object because it's not async
        observables, unknown = observable.save_from_file(file=file.file, tags=tags)

    except ValueError as error:
        raise HTTPException(status_code=400, detail=str(error))

    for obs in observables:
        audit.log_timeline(httpreq.state.username, obs, action="import-file")
        rbac.set_acls(obs, user=httpreq.state.user)
    return BulkObservableAddResponse(added=observables, failed=unknown)
Adds and returns observables from a given url, attempting to guess
    their types.
core/web/apiv2/observables.py