Package to interact with the Modulos Platform
Project description
Modulos Client
This tool provides a Programmatic interface to interact with the Modulos platform.
Documentation
The documentation can be found on docs.modulos.ai
Installation
# install from PyPI
pip install modulos-client
API Key
Generate your API key here
Usage
import os
from modulos_client import Modulos
client = Modulos(
# This is the default and can be omitted
api_key=os.environ.get("MODULOS_API_KEY"),
)
While you can provide an api_key
keyword argument,
we recommend using python-dotenv
to add MODULOS_API_KEY="My API Key"
to your .env
file
so that your API Key is not stored in source control.
Handling errors
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of modulos_client.APIConnectionError
is raised.
When the API returns a non-success status code (that is, 4xx or 5xx
response), a subclass of modulos_client.APIStatusError
is raised, containing status_code
and response
properties.
All errors inherit from modulos_client.APIError
.
import modulos_client
from modulos_client import Modulos
client = Modulos()
try:
metrics = client.testing.logs.get_metrics(project_id)
except modulos_client.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
except modulos_client.APIStatusError as e:
print("Another non-200-range status code was received")
print(e.status_code)
print(e.response)
Error codes are as followed:
Status Code | Error Type |
---|---|
400 | BadRequestError |
401 | AuthenticationError |
403 | PermissionDeniedError |
404 | NotFoundError |
422 | UnprocessableEntityError |
>=500 | InternalServerError |
N/A | APIConnectionError |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for modulos_client-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a43ec3d50242aa6bf6266fdae3fc9ddbf5821863fcf73522c75de1ed826fe8f |
|
MD5 | 2b9f10be60b45607e0e0d1e144361404 |
|
BLAKE2b-256 | 6c5f18cdd1fe66f2d4119f4cfc38babdc606e5469a994ad8e92b0728987f305f |