modulos-client


Namemodulos-client JSON
Version 0.9.0 PyPI version JSON
download
home_pageNone
SummaryPackage to interact with the Modulos Platform
upload_time2024-08-12 12:27:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords modulos_client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Modulos Client

[![PyPI version](https://img.shields.io/pypi/v/modulos-client.svg)](https://pypi.org/project/modulos-client/)

This tool provides a Programmatic interface to interact with the Modulos platform.

## Documentation

The documentation can be found on [docs.modulos.ai](https://docs.modulos.ai)

## Installation

```sh
# install from PyPI
pip install modulos-client
```

## API Key

Generate your API key [here](https://app.modulos.ai/tokens)

## Usage

```python
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](https://pypi.org/project/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`.

```python
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`       |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "modulos-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "modulos_client",
    "author": null,
    "author_email": "Modulos AG <contact@modulos.ai>",
    "download_url": "https://files.pythonhosted.org/packages/11/46/0471c8f4f7246e608f21d89156e330a866f49d936a83742ac49ee5d17a5a/modulos_client-0.9.0.tar.gz",
    "platform": null,
    "description": "# Modulos Client\n\n[![PyPI version](https://img.shields.io/pypi/v/modulos-client.svg)](https://pypi.org/project/modulos-client/)\n\nThis tool provides a Programmatic interface to interact with the Modulos platform.\n\n## Documentation\n\nThe documentation can be found on [docs.modulos.ai](https://docs.modulos.ai)\n\n## Installation\n\n```sh\n# install from PyPI\npip install modulos-client\n```\n\n## API Key\n\nGenerate your API key [here](https://app.modulos.ai/tokens)\n\n## Usage\n\n```python\nimport os\nfrom modulos_client import Modulos\n\nclient = Modulos(\n    # This is the default and can be omitted\n    api_key=os.environ.get(\"MODULOS_API_KEY\"),\n)\n```\n\nWhile you can provide an `api_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `MODULOS_API_KEY=\"My API Key\"` to your `.env` file\nso that your API Key is not stored in source control.\n\n## Handling errors\n\nWhen 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.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `modulos_client.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `modulos_client.APIError`.\n\n```python\nimport modulos_client\nfrom modulos_client import Modulos\n\nclient = Modulos()\n\ntry:\n    metrics = client.testing.logs.get_metrics(project_id)\nexcept modulos_client.APIConnectionError as e:\n    print(\"The server could not be reached\")\n    print(e.__cause__)  # an underlying Exception, likely raised within httpx.\nexcept modulos_client.APIStatusError as e:\n    print(\"Another non-200-range status code was received\")\n    print(e.status_code)\n    print(e.response)\n```\n\nError codes are as followed:\n\n| Status Code | Error Type                 |\n| ----------- | -------------------------- |\n| 400         | `BadRequestError`          |\n| 401         | `AuthenticationError`      |\n| 403         | `PermissionDeniedError`    |\n| 404         | `NotFoundError`            |\n| 422         | `UnprocessableEntityError` |\n| >=500       | `InternalServerError`      |\n| N/A         | `APIConnectionError`       |\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Package to interact with the Modulos Platform",
    "version": "0.9.0",
    "project_urls": {
        "Bug Reports": "https://github.com/Modulos/modulos_client/issues",
        "Homepage": "https://github.com/Modulos/modulos_client",
        "Source": "https://github.com/Modulos/modulos_client"
    },
    "split_keywords": [
        "modulos_client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c5f18cdd1fe66f2d4119f4cfc38babdc606e5469a994ad8e92b0728987f305f",
                "md5": "2b9f10be60b45607e0e0d1e144361404",
                "sha256": "9a43ec3d50242aa6bf6266fdae3fc9ddbf5821863fcf73522c75de1ed826fe8f"
            },
            "downloads": -1,
            "filename": "modulos_client-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2b9f10be60b45607e0e0d1e144361404",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 10181,
            "upload_time": "2024-08-12T12:27:34",
            "upload_time_iso_8601": "2024-08-12T12:27:34.524052Z",
            "url": "https://files.pythonhosted.org/packages/6c/5f/18cdd1fe66f2d4119f4cfc38babdc606e5469a994ad8e92b0728987f305f/modulos_client-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "11460471c8f4f7246e608f21d89156e330a866f49d936a83742ac49ee5d17a5a",
                "md5": "f9e1b4a7800b4dd9f443a7423e6b7e60",
                "sha256": "b9647d458fc66030c897f992ab4fe7e2e8db3e2edcaacc1aa327cea452da8d97"
            },
            "downloads": -1,
            "filename": "modulos_client-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f9e1b4a7800b4dd9f443a7423e6b7e60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 14569,
            "upload_time": "2024-08-12T12:27:35",
            "upload_time_iso_8601": "2024-08-12T12:27:35.582447Z",
            "url": "https://files.pythonhosted.org/packages/11/46/0471c8f4f7246e608f21d89156e330a866f49d936a83742ac49ee5d17a5a/modulos_client-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-12 12:27:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Modulos",
    "github_project": "modulos_client",
    "github_not_found": true,
    "lcname": "modulos-client"
}
        
Elapsed time: 0.34098s