Skip to main content

Package to interact with the Modulos Platform

Project description

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

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

modulos_client-1.0.4.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modulos_client-1.0.4-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file modulos_client-1.0.4.tar.gz.

File metadata

  • Download URL: modulos_client-1.0.4.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.13

File hashes

Hashes for modulos_client-1.0.4.tar.gz
Algorithm Hash digest
SHA256 333f340970d8932be01e10dee757b1565d54064d6df5bf44f1abc65221bdfd51
MD5 99b44e3f79738c4a11d2dd9029c42e92
BLAKE2b-256 d938e08ffcecdcc2d765987b15bc1ebe8554594639ce60497c9b1b64debe8f6b

See more details on using hashes here.

File details

Details for the file modulos_client-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: modulos_client-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.13

File hashes

Hashes for modulos_client-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0479599025b42fe3a415350b9dafa3f119744a2a5960e2e4477d1c9c8287ecae
MD5 dfef64e8531b6e528c021b28e522b8a4
BLAKE2b-256 3e754ea16b218f1d5bf0e273e0192636083623b893e85c64773f26f60addd915

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page