Skip to main content

Metis infra API client in Python

Project description

Metis API client

DOI PyPI

This library allows for programmatic interactions with the Metis infrastructure.

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:

from metis_client import MetisAPIAsync, MetisTokenAuth

async 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)
        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:

from metis_client import MetisAPI, MetisTokenAuth

client = MetisAPI(API_URL, auth=MetisTokenAuth("VERY_SECRET_TOKEN"), timeout=5)
data = client.v0.datasources.create(content)
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. admin@test.com (refer to users_emails BFF table).

Contributing

Please give a minute to the contribution guide. Note, that our changelog is maintained fully automatically via GitHub actions.

License

Author Sergey Korolev, Tilde Materials Informatics

Copyright 2023 BASF SE

BSD 3-Clause

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

metis_client-0.7.1.tar.gz (82.1 kB view details)

Uploaded Source

Built Distribution

metis_client-0.7.1-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file metis_client-0.7.1.tar.gz.

File metadata

  • Download URL: metis_client-0.7.1.tar.gz
  • Upload date:
  • Size: 82.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for metis_client-0.7.1.tar.gz
Algorithm Hash digest
SHA256 874942f7c8b23121267859d8b737a81080e9323891719f57f0dc054cc9136e9d
MD5 993e5c83937ff15f0ef68fd2c35910e6
BLAKE2b-256 78310999a32fcb055cd5ee97eee3214853d073be8097d1f96c7f21b3b6fe2b2b

See more details on using hashes here.

File details

Details for the file metis_client-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: metis_client-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for metis_client-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97a067bef6aeb321e043a47de967b44fcc1e8cd72defaf742264abfb443d35d9
MD5 73db1f06828360faf3e848b878680ca1
BLAKE2b-256 f1c7340e89787eba947f0faed4dc88834d2488867114cef4188f754569c19a1d

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