drs_cli package

Submodules

drs_cli.client module

Class implementing DRS client.

class drs_cli.client.DRSClient(uri: str, port: Optional[int] = None, base_path: Optional[str] = 'ga4gh/drs/v1', use_http: bool = False, token: Optional[str] = None)

Bases: object

Client to communicate with a GA4GH DRS instance. Supports additional endpoints defined in DRS-filer (https://github.com/elixir-cloud-aai/drs-filer).

Parameters:
uri

URI to DRS endpoints, built from uri, port and base_path, e.g.,”https://my-drs.app:443/ga4gh/drs/v1”.

token

Bearer token for gaining access to DRS endpoints.

headers

Dictionary of request headers.

delete_object(object_id: str, token: Optional[str] = None) → Union[str, drs_cli.models.Error]

Delete DRS object.

Parameters:
Returns:

ID of previously registered DRS object in case of a 200 response, or an instance of Error for all other responses.

Raises:
  • requests.exceptions.ConnectionError – A connection to the provided DRS instance could not be established.
  • drs_cli.errors.InvalidResponseError – The response could not be validated against the API schema.
get_access_url(object_id: str, access_id: str, token: Optional[str] = None) → Union[drs_cli.models.AccessURL, drs_cli.models.Error]

Retrieve access URL of DRS object.

Parameters:
Returns:

Unmarshalled DRS response as either an instance of AccessURL in case of a 200 response, or an instance of Error for all other reponses.

Raises:
  • requests.exceptions.ConnectionError – A connection to the provided DRS instance could not be established.
  • drs_cli.errors.InvalidResponseError – The response could not be validated against the API schema.
get_object(object_id: str, token: Optional[str] = None) → Union[drs_cli.models.Error, drs_cli.models.DrsObject]

Retrieve DRS object.

Parameters:
Returns:

Unmarshalled DRS response as either an instance of DRSObject in case of a 200 response, or an instance of Error for all other JSON reponses.

Raises:
  • requests.exceptions.ConnectionError – A connection to the provided DRS instance could not be established.
  • drs_cli.errors.InvalidResponseError – The response could not be validated against the API schema.
post_object(object_data: Dict[KT, VT], token: Optional[str] = None) → Union[str, drs_cli.models.Error]

Register DRS object.

Parameters:
  • object_data – DRS object data.
  • token – Bearer token for authentication. Set if required by DRS implementation and if not provided when instatiating client or if expired.
Returns:

ID of registered DRS object in case of a 200 response, or an instance of Error for all other responses.

Raises:

drs_cli.errors module

exception drs_cli.errors.InvalidObjectData

Bases: Exception

Exception raised when object data cannot be validated against the API schema.

exception drs_cli.errors.InvalidResponseError

Bases: Exception

Exception raised when an invalid API response is encountered.

exception drs_cli.errors.InvalidURI

Bases: Exception

Exception raised for invalid URIs.

drs_cli.errors.exception_handler(_type: type, value: BaseException, traceback: traceback) → None

Error handler for all exceptions.

drs_cli.models module

API models; autogenerated by https://github.com/koxudaxi/datamodel-code-generator/.

class drs_cli.models.AccessMethod

Bases: pydantic.main.BaseModel

class drs_cli.models.AccessPostMethod

Bases: pydantic.main.BaseModel

class drs_cli.models.AccessURL

Bases: pydantic.main.BaseModel

class drs_cli.models.Checksum

Bases: pydantic.main.BaseModel

class drs_cli.models.DrsObject

Bases: pydantic.main.BaseModel

class drs_cli.models.Error

Bases: pydantic.main.BaseModel

class drs_cli.models.PostDrsObject

Bases: pydantic.main.BaseModel

class drs_cli.models.Type

Bases: enum.Enum

An enumeration.

file = 'file'
ftp = 'ftp'
globus = 'globus'
gs = 'gs'
gsiftp = 'gsiftp'
htsget = 'htsget'
https = 'https'
s3 = 's3'