Gen3 File Class

class gen3.file.Gen3File(endpoint, auth_provider)[source]

Bases: object

For interacting with Gen3 file management features.

A class for interacting with the Gen3 file download services. Supports getting presigned urls right now.

Parameters:
  • endpoint (str) – The URL of the data commons.
  • auth_provider (Gen3Auth) – A Gen3Auth class instance.

Examples

This generates the Gen3File class pointed at the sandbox commons while using the credentials.json downloaded from the commons profile page.

>>> endpoint = "https://nci-crdc-demo.datacommons.io"
... auth = Gen3Auth(endpoint, refresh_file="credentials.json")
... sub = Gen3File(endpoint, auth)
get_presigned_url(guid, protocol='http')[source]

Generates a presigned URL for a file.

Retrieves a presigned url for a file giving access to a file for a limited time.

Parameters:
  • guid (str) – The GUID for the object to retrieve.
  • protocol (str, optional) – The protocol to use for picking the available URL for generating the presigned URL.

Examples

>>> Gen3File.get_presigned_url(query)