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
File details
Details for the file modulos_client-0.9.0.tar.gz
.
File metadata
- Download URL: modulos_client-0.9.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9647d458fc66030c897f992ab4fe7e2e8db3e2edcaacc1aa327cea452da8d97 |
|
MD5 | f9e1b4a7800b4dd9f443a7423e6b7e60 |
|
BLAKE2b-256 | 11460471c8f4f7246e608f21d89156e330a866f49d936a83742ac49ee5d17a5a |
File details
Details for the file modulos_client-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: modulos_client-0.9.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a43ec3d50242aa6bf6266fdae3fc9ddbf5821863fcf73522c75de1ed826fe8f |
|
MD5 | 2b9f10be60b45607e0e0d1e144361404 |
|
BLAKE2b-256 | 6c5f18cdd1fe66f2d4119f4cfc38babdc606e5469a994ad8e92b0728987f305f |