Skip to main content

GA4GH DRS Client

Project description

DRS-cli

License Build_status Coverage GitHub_tag PyPI_release

This repository contains a client for an implementation of the Data Repository Service API schema of the Global Alliance for Genomics and Health, including support for additional endpoints defined in ELIXIR Cloud & AAI's DRS-Filer DRS implementation.

Usage

To use the client import it as follows in your Python code after installation:

Create client instance

from drs_cli.client import DRSClient

client = DRSClient(
    host="https://my-drs.app",
    port=80,
    base_path="ga4gh/drs/v1",
)

It is possible to supply a Bearer token, which will then be added to the Authentication header (prepended by Bearer) for every outbound call:

from drs_cli.client import DRSClient

client = DRSClient(
    host="https://my-drs.app",
    port=80,
    base_path="ga4gh/drs/v1",
    token = "<some_token>",
)

Access endpoints

NOTES:

  • All endpoint access methods accept an optional token argument that allows overwriting any token supplied when creating the client instance.
  • Responses that do not return the object ID as a single string return Pydantic models instead. If dictionaries are preferred instead, they can be obtained with response.dict(). See the Pydantic export documentation for further details.

GET endpoints

The DRS GET /objects/{object_id} endpoint can then be accessed with, e.g.:

response = client.get_object(
    object_id="A3SF4B",
)

Similarly, the DRS GET /objects/{object_id}/access/{access_id} endpoint can be accessed with, e.g.:

response = client.get_access_url(
    object_id="A3SF4B",
    access_id="B44FG9",
)

POST endpoint

The DRS-Filer POST /objects endpoint can be accessed with, e.g.:

response = client.post_object(
    object_data={
        "created_time": "2019-05-20T00:12:34-07:00",
        "updated_time": "2019-04-24T05:23:43-06:00",
        "version": "1",
        "size": 5,
        "mime_type": "",
        "checksums": [
            {
            "checksum": "18c2f5517e4ddc02cd57f6c7554b8e88",
            "type": "md5"
            }
        ],
        "access_methods": [
            {
            "type": "ftp",
            "access_url": {
                "url": "ftp://my.ftp.server/my_path/my_file_01.txt",
                "headers":  [
                "None"
                ]
            }
            }
        ]
    }
)

DELETE endpoint

The DRS-Filer DELETE /objects/{object_id} endpoint can be accessed with, e.g.:

response = client.delete_object(
    object_id="A3SF4B",
)

API docs

Automatically built API documentation is available.

Installation

You can install DRS-cli in one of two ways:

Installation via package manager

pip install drs_cli

# Or for latest development version:
pip install -e git+https://github.com/elixir-cloud-aai/DRS-cli.git#egg=drs_cli

Manual installation

git clone https://github.com/elixir-cloud-aai/DRS-cli.git
cd DRS-cli
python setup.py install

Contributing

This project is a community effort and lives off your contributions, be it in the form of bug reports, feature requests, discussions, or fixes and other code changes. Please refer to our organization's contributing guidelines if you are interested to contribute. Please mind the code of conduct for all interactions with the community.

Versioning

The project adopts the semantic versioning scheme for versioning. Currently the service is in beta stage, so the API may change without further notice.

License

This project is covered by the Apache License 2.0 also shipped with this repository.

Contact

The project is a collaborative effort under the umbrella of ELIXIR Cloud & AAI. Follow the link to get in touch with us via chat or email. Please mention the name of this service for any inquiry, proposal, question etc.

logo_banner

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drs_cli-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drs_cli-0.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file drs_cli-0.1.0.tar.gz.

File metadata

  • Download URL: drs_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4

File hashes

Hashes for drs_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 747d32e44b0d8af43dd6208f19d35e7b06842afcfdc90e79c3bac862e2f4f4f2
MD5 6cae4c677627eb8805909824e305df79
BLAKE2b-256 81154544cd31d3b68dbaa968b42ccb90d7d8e84171c2f4a470003f04576b1a2f

See more details on using hashes here.

File details

Details for the file drs_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: drs_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4

File hashes

Hashes for drs_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57ffa6aa21187a81bcd2fda3c2a53f575f6c7cb8fa97f553d97b1059d3aab8ac
MD5 cc49a0127c789c2dd9b5533fa9b15be5
BLAKE2b-256 48e27700185d06936622d9c6e63fbaec49ea794708b7f80404c3be8d00fd2bb0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page