GA4GH DRS Client
Project description
DRS-cli
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.