Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tilde-lab/metis-client
Metis infrastructure API client in Python
https://github.com/tilde-lab/metis-client
Last synced: about 2 months ago
JSON representation
Metis infrastructure API client in Python
- Host: GitHub
- URL: https://github.com/tilde-lab/metis-client
- Owner: tilde-lab
- License: bsd-3-clause
- Created: 2022-11-09T11:18:50.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T13:55:37.000Z (8 months ago)
- Last Synced: 2024-05-22T14:45:07.925Z (8 months ago)
- Language: Python
- Homepage:
- Size: 313 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# Metis API client
[![DOI](https://zenodo.org/badge/563802198.svg)](https://doi.org/10.5281/zenodo.7693569)
[![PyPI](https://img.shields.io/pypi/v/metis_client.svg?style=flat)](https://pypi.org/project/metis-client)This library allows for programmatic interactions with the [Metis infrastructure](https://github.com/search?q=org%3Abasf+metis).
## Installation
`pip install metis_client`
## Usage
There are two client flavors: **asyncronous** `asyncio` client
and simplified **synchronous** client.### Asynchronous client
An asynchronous client is `MetisAPIAsync`. Example of usage:
```python
from metis_client import MetisAPIAsync, MetisTokenAuthasync def main():
async with MetisAPIAsync(API_URL, auth=MetisTokenAuth("VERY_SECRET_TOKEN")) as client:
print(await client.v0.auth.whoami())
data = await client.v0.datasources.create(content, name)
results = await client.v0.calculations.create_get_results(data["id"])
print(resuls)
```See `examples` directory for more examples.
### Synchronous client
A synchronous client is `MetisAPI`. Example of usage:
```python
from metis_client import MetisAPI, MetisTokenAuthclient = MetisAPI(API_URL, auth=MetisTokenAuth("VERY_SECRET_TOKEN"), timeout=5)
data = client.v0.datasources.create(content, name)
results = client.v0.calculations.create_get_results(data["id"], timeout=False)
print(results)
```NB in development one can replace a `VERY_SECRET_TOKEN` string with the development user email, e.g.
`[email protected]` (refer to **users_emails** BFF table).## Contributing
Please give a minute to the [contribution guide](https://github.com/metis-science/metis-client/blob/master/CONTRIBUTING.md). Note, that our [changelog](https://github.com/metis-science/metis-client/blob/master/CHANGELOG.md) is maintained fully automatically via [GitHub actions](https://github.com/metis-science/metis-client/tree/master/.github/workflows). An approved release is also automatically uploaded to PyPI. Feel free to use these actions in your own repo, just set the correct repo name in the action `.yml` file.
## License
Author Sergey Korolev, Tilde Materials Informatics
Copyright 2023 BASF SE
BSD 3-Clause