This library allows for programmatic interactions with the Metis infrastructure.
pip install metis_client
There are two client flavors: asyncronous asyncio
client
and simplified synchronous 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, name)
results = await client.v0.calculations.create_get_results(data["id"])
print(resuls)
See examples
directory for more examples.
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, 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.
admin@test.com
(refer to users_emails BFF table).
Please give a minute to the contribution guide. Note, that our changelog is maintained fully automatically via GitHub actions. 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.
Author Sergey Korolev, Tilde Materials Informatics
Copyright 2023 BASF SE
BSD 3-Clause