Skip to main content

Python client for Run:ai REST API

Project description

runapy

This project provides a Python client to interact with the Run:ai REST API.

The client offers:

  • A single classs interface to perform all API actions
  • Body scheme validation on compilation (with Pydantic)
  • Static type checks
  • Retry mechanism for resiliency on intermittent network errors
  • Debug messages flag

Requirements:

Note on token and permissions

When creating an application, it is important to select the relevant role and scope for the required API actions.
Some API calls may fail with 403 if the application token has no sufficient permissions.

Installation

runapy is avaialble in PyPi and can be downloaded directly as a python package

pip3 install runapy

Or you can clone the repo and run it with poetry:

git clone https://github.com/ofir-eldar1/runapy
poetry install
poetry run python3 main.py

Client

RunaiClient is the only class required to interact with the Run:ai REST API https://app.run.ai/api/docs

import runai

client = runai.RunaiClient(
            realm="myorgrealm",
            client_id="API"
            client_secret="clientsecret",
            runai_base_url="https://myorg.run.ai",
            cluster_id="513423qx-127t-4yk6-979g-5po843g37e2b",
            retries=3,
            debug=False
    )
Parameter Type Description
realm string Required: Can be obtained from the UI login screen at your Run:ai domain app.run.ai -> app.run.ai/auth/realms/
client_id string Required: The Run:ai application name
client_secret string Required: The Run:ai application password
runai_base_url string Required: The URL used to access Run:ai UI
retries int Required: Number of retries to attempt on each failed API call for 5xx errors
debug bool Optional: Debug mode output

Examples

See examples here

Warranty

This package is not maintained by the Run:ai product.

For any issues and requests, please open an issue, or contact the authors of this package.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

runapy-0.1.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

runapy-0.1.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file runapy-0.1.1.tar.gz.

File metadata

  • Download URL: runapy-0.1.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0

File hashes

Hashes for runapy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2178bd9f4a6b25b0b63e8c98c59195fb082dbbc756679f1549dcbd86c5c585c4
MD5 e258b1d87fd4db06935a6f5d106a9388
BLAKE2b-256 3a6378f3ab78395b8864cdea94b122ade0f34bfbd15c79fbe718e505196201e6

See more details on using hashes here.

File details

Details for the file runapy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: runapy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0

File hashes

Hashes for runapy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a60750a89f0fe7b457333c3d085aee9e4c90ccd51907ee4e0974493b37a6d010
MD5 ae2e6ec75a4280393ad0d1fe4d54838f
BLAKE2b-256 00d59e32d7a4a2323872e819fa8042abb632ea960b3541949c23f0a00dd00651

See more details on using hashes here.

Supported by

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