Skip to main content

bravado generated mock GA4GH DRS client

Project description

PyPI version PyPI - Python Version

DRS-cli

This repository contains a Bravado-based client for a mockup implementation of the Data Repository Service API schema of the Global Alliance for Genomics and Health, as described in the mock-DRS repository. The client was developed for the use within the TEStribute task distribution logic application.

Usage

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

import drs_client

client = drs_client.Client("http://localhost:9101/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:

client = tes_client.Client(
   url="https://path.to/swagger.json",
   jwt="SomET0kEn"
)

Note that the indicated URL is valid when mock-DRS was installed at the default location on your local machine. When a different DRS instance is supposed to be used, replace the full URL (including http:// or https://).

Access the mock-DRS GET /objects/{object_id} endpoint with, e.g.:

response = client.GetObject("a001")

Access the mock-DRS POST /update-db endpoint with, e.g.:

response = client.updateDatabaseObjects(
    clear_db=True,
    objects=[
        {
            "access_methods": [
                {
                    "access_id": "string",
                    "access_url": {"headers": ["Authorization"], "url": "string"},
                    "region": "us-east-1",
                    "type": "s3",
                }
            ],
            "aliases": ["string"],
            "checksums": [{"checksum": "string", "type": "string"}],
            "created": "string",
            "description": "string",
            "id": "string",
            "mime_type": "application/json",
            "name": "string",
            "size": 0,
            "updated": "string",
            "version": "string",
        },
    ],
)

the objects list can contain any number of such drs_object dicts and the clear_db indicates weather or not the db should be emptied before upload of specified objects.

For further details on populating the DRS via the POST /update-db endpoint, please see the documentation in the mock-DRS repository.

Note that all other endpoints are currently not implemented.

Installation

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

Manual installation

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

Installation via package manager

pip install -e git+https://github.com/elixir-europe/DRS-cli.git#egg=drs_client

or

pip install drs_client

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 read the contributing guidelines if you want to contribute. And please mind the code of conduct for all interactions with the community.

Versioning

Development of the app is currently still in alpha stage, and current versioning is for internal use only. In the future, we are aiming to adopt semantic versioning that is synchronized to the versioning of TEStribute and [mock-TES] in order to ensure that these apps will be compatible as long as both their major and minor versions match.

License

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

Contact

Please contact the project leader for inquiries, proposals, questions etc. that are not covered by the Contributing section.

Acknowledgments

The project is a collaborative effort under the umbrella of the ELIXIR Cloud and AAI group. It was started during the 2019 Google Summer of Code as part of the Global Alliance for Genomics and Health organization.

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_client-0.2.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

drs_client-0.2.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file drs_client-0.2.0.tar.gz.

File metadata

  • Download URL: drs_client-0.2.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for drs_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5ce4fd2eec4f4d264acd8c34281fd99c9fea968b48173d850e054ccb71806af1
MD5 0f519cf15c7785287ff22d64ed55b671
BLAKE2b-256 156d68256c5a2f0eccdd156ba02423ee178cd9c13eb6a7445d851d27c32f702c

See more details on using hashes here.

File details

Details for the file drs_client-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: drs_client-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for drs_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbd1f20dcdc5a9582a2fe1c3ba27cc8bd133e5394a90ed3b3edef15978472edc
MD5 e4020e03ca9d56c53c3c560bfadc4d48
BLAKE2b-256 b87af23d244f2377cee3132f7498aa7a0e3f61ba05ce8dc25a89e90972fd8444

See more details on using hashes here.

Supported by

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