User API Session¶
-
class
lfview.client.session.UploadSession(api_key, service=None, source=None, client_version=None, endpoint=None)¶ User session object for uploading data through the View API
This class will likely be future-compatible with changes to the API.Required Properties:
- api_key (
String): LF View API Key, a unicode string - client_version (
String): Information about the API client, a unicode string, Default: View API Python Client v0.1.0 - source (
String): Provenance information for uploaded data, a unicode string, Default: View API Python Client v0.1.0 - upload_api_url_spec (
String): Format string spec to build upload URL, a unicode string - upload_base_url (
String): URL for the default project of the user, discovered implicitly from the API, a unicode string
Optional Properties:
- service (
String): Base API service, a unicode string
Other Properties:
- headers (dynamic
Dictionary): Headers to authenticate the user for API access, a dictionary created dynamically - session (dynamic
Session): Underlying requests session object, an instance of Session created dynamically
-
invite_to_view(view, email, role, send_email=False, message=None)¶ Invite members to a View with their email
Parameters:
- view - View API URL or instance of
lfview.resources.manifests.manifests.View - email - email address of user to invite
- role - role to assign, either ‘view.editor’ or ‘view.spectator’
- send_email - send email to invited user with link to the view
- message - message to include in the email if send_email is True
- view - View API URL or instance of
-
upload(resource, verbose=False, update_contents=True, thumbnail=None, chunk_size=20971520, parallel=True, workers=100, executor=None)¶ Upload new resource to your Project or update existing resource
This includes spatial resources (elements, data, etc), files (arrays, images), and Views.
Parameters:
- resource - any of the above resource objects
- verbose - if True, print logging messages
- update_contents - This only applies when you are uploading a View. If update_contents is True (the default) contents will be dynamically updated on upload. Set this to False if you want to specify contents explicitly.
- thumbnail - image to upload as thumbnail for the View; this may also be updated in the web app.
- chunk_size - chunk size for file upload, must be a multiple of 256 * 1024. By default, 20 MB (80 * 256 * 1024) is used.
- parallel - Perform concurrent uploads using Python threading. By default, this is True if concurrent.futures is available.
- workers - Maximum number of thread workers to use; ignored if parallel=False or alternative executor is provided. Default is 100.
- executor - Alternative function executor for parallelization.
Must implement
executor.submit(fn, *args, **kwargs)andexecutor.shutdown(wait). Thesubmitmethod must return a “future” object that implementsfuture.done()andfuture.result().
- api_key (
-
class
lfview.client.session.Session(api_key, service=None, source=None, client_version=None, endpoint=None)¶ View Session class with more functionality than UploadSession
This functionality includes slide/feedback uploads as well as downloads.
Warning: Support for these operations using this version of the View API Python client may be deprecated at any time without warning.
Required Properties:
- api_key (
String): LF View API Key, a unicode string - client_version (
String): Information about the API client, a unicode string, Default: View API Python Client v0.1.0 - source (
String): Provenance information for uploaded data, a unicode string, Default: View API Python Client v0.1.0 - upload_api_url_spec (
String): Format string spec to build upload URL, a unicode string - upload_base_url (
String): URL for the default project of the user, discovered implicitly from the API, a unicode string
Optional Properties:
- service (
String): Base API service, a unicode string
Other Properties:
- headers (dynamic
Dictionary): Headers to authenticate the user for API access, a dictionary created dynamically - session (dynamic
Session): Underlying requests session object, an instance of Session created dynamically
-
delete(resource)¶ Delete a downloaded resource
This includes spatial resources (elements, data, etc), files (arrays, images), Views, and slides.
Parameters:
- resource - Downloaded API resource or URL of resource to delete
-
download(url, recursive=True, copy=False, verbose=False, allow_failure=False, parallel=True, workers=100, executor=None)¶ Download resources from a Project
This includes spatial resources (elements, data, etc), files (arrays, images), Views, and slides.
Parameters:
- url - URL for resource to download
- recursive - if True (the default), follow pointers and download all data. If False, just keep URLs for pointers
- copy - If False (the default), downloaded objects will be associated with the source resources and re-uploading will modify the source
- verbose - if True, print logging messages
- allow_failure - if True, failure to retrieve a resource simply returns the url rather than raising an error. This is possibly useful when recursively downloading a View with limited permissions. Default is False.
- parallel - Perform concurrent downloads using Python threading. By default, this is True if concurrent.futures is available.
- workers - Maximum number of thread workers to use; ignored if parallel=False or alternative executor is provided. Default is 100.
- executor - Alternative function executor for parallelization.
Must implement
executor.submit(fn, *args, **kwargs)andexecutor.shutdown(wait). Thesubmitmethod must return a “future” object that implementsfuture.done()andfuture.result().
-
invite_to_view(view, email, role, send_email=False, message=None)¶ Invite members to a View with their email
Parameters:
- view - View API URL or instance of
lfview.resources.manifests.manifests.View - email - email address of user to invite
- role - role to assign, either ‘view.editor’ or ‘view.spectator’
- send_email - send email to invited user with link to the view
- message - message to include in the email if send_email is True
- view - View API URL or instance of
-
upload(resource, verbose=False, update_contents=True, thumbnail=None, chunk_size=20971520, parallel=True, workers=100, executor=None)¶ Upload new resource to your Project or update existing resource
This includes spatial resources (elements, data, etc), files (arrays, images), and Views.
Parameters:
- resource - any of the above resource objects
- verbose - if True, print logging messages
- update_contents - This only applies when you are uploading a View. If update_contents is True (the default) contents will be dynamically updated on upload. Set this to False if you want to specify contents explicitly.
- thumbnail - image to upload as thumbnail for the View; this may also be updated in the web app.
- chunk_size - chunk size for file upload, must be a multiple of 256 * 1024. By default, 20 MB (80 * 256 * 1024) is used.
- parallel - Perform concurrent uploads using Python threading. By default, this is True if concurrent.futures is available.
- workers - Maximum number of thread workers to use; ignored if parallel=False or alternative executor is provided. Default is 100.
- executor - Alternative function executor for parallelization.
Must implement
executor.submit(fn, *args, **kwargs)andexecutor.shutdown(wait). Thesubmitmethod must return a “future” object that implementsfuture.done()andfuture.result().
-
upload_feedback(feedback, slide=None, verbose=True)¶ Upload Feedback to a Slide
Parameters:
- feedback -
lfview.resources.scene.slide.Feedbackobject or text comment. - slide - Slide URL or instance to upload the Feedback to
- verbose - if True, print logging messages
- feedback -
-
upload_slide(slide, view=None, verbose=False, autofill_plane=True, thumbnail=None, chunk_size=20971520)¶ Upload a Slide to a View
Parameters:
- slide -
lfview.resources.scene.slide.Slideobject - view - View URL or instance to upload the slide to
- verbose - if True, print logging messages
- autofill_plane - if True (the default), the annotation drawing plane is automatically filled in if not provided.
- thumbnail - image to upload as thumbnail for the slide; this may also be updated in the web app.
- chunk_size - chunk size for thumbnail upload, must be a multiple of 256 * 1024. By default, 20 MB (80 * 256 * 1024) is used.
- slide -
- api_key (