Skip to main content

Modulos Client

PyPI version

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

Release files for modulos-client 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modulos-client 1.0.4
File Size Uploaded
modulos_client-1.0.4.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for modulos-client 1.0.4
File Interpreter ABI Platform
modulos_client-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 25.2 kB

Release files / modulos_client-1.0.4.tar.gz

Download URL modulos_client-1.0.4.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
333f340970d8932be01e10dee757b1565d54064d6df5bf44f1abc65221bdfd51
BLAKE2b-256 checksum
How to use checksums
d938e08ffcecdcc2d765987b15bc1ebe8554594639ce60497c9b1b64debe8f6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.13

Release files / modulos_client-1.0.4-py3-none-any.whl

Download URL modulos_client-1.0.4-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0479599025b42fe3a415350b9dafa3f119744a2a5960e2e4477d1c9c8287ecae
BLAKE2b-256 checksum
How to use checksums
3e754ea16b218f1d5bf0e273e0192636083623b893e85c64773f26f60addd915
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.13

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page