def import_from_url(
    httpreq: Request, request: ImportUrlRequest
) -> BulkObservableAddResponse:
    """Adds and returns observables from a given url, attempting to guess
    their types."""
    if not validators.url(request.text):
        raise HTTPException(status_code=400, detail="Invalid URL")
    try:
        observables, unknown = observable.save_from_url(
            value=request.url, tags=request.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-url")
        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