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:
- Run:ai control-plane version of 2.18 and above
- Python version of 3.11 or above
- Run:ai Client Application
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
from runapy import RunaiClient
client = 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
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 runapy-0.1.0.tar.gz
.
File metadata
- Download URL: runapy-0.1.0.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31779e09c3da86384abc28f6573d96d79dbd46b3f3963f0aaf4970fd0d527577 |
|
MD5 | ad70318ecb2b8ac14d7cfd4d1011108b |
|
BLAKE2b-256 | 76aa105bad0192c8fec3024b8d57a1d080d5c97efaa26e231e3ee7657a990dd8 |
File details
Details for the file runapy-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: runapy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.3 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a265abc683376846143822d3e79be27713369ca6516531ec80728483f7a3f327 |
|
MD5 | be2e6455f70dbd3ea76e1c7d99b9e2ee |
|
BLAKE2b-256 | 50f7666ff94798ef28b3eebace3c6094e04a9953ad855ca5f0c7f4b63afb07a9 |