This is a lightweight library that works as a connector to Yottalabs public API.
Project description
Yottalabs Public API Connector Python
This is a lightweight library that works as a connector to Yottalabs public API
- Supported APIs:
/openapi/v1/*
- Inclusion of examples
- Customizable base URL, request timeout and HTTP proxy
Installation
pip install yottactl
RESTful APIs
Usage examples:
from yotta.pod import PodApi
# API key is required for user data endpoints
client = PodApi(api_key='<api_key>')
# Post a new order
params = {
"image": "yottalabsai/pytorch:2.8.0-py3.11-cuda12.8.1-cudnn-devel-ubuntu22.04-2025050802",
"gpu_type": "NVIDIA_L4_24G",
"gpu_count": 1,
"expose": [
{
"port": 22,
"protocol": "SSH"
}
]
}
response = client.new_pod(**params)
print(response)
Please find examples folder to check for more endpoints.
- In order to set your API for use of the examples, create a file
examples/config.iniwith your keys. - Eg:
# examples/config.ini [keys] api_key=abc123456
Base URL
If base_url is not provided, it defaults to https://api.yottalabs.ai.
Timeout
timeout is available to be assigned with the number of seconds you find most appropriate to wait for a server
response.
Please remember the value as it won't be shown in error message no bytes have been received on the underlying socket
for timeout seconds.
By default, timeout is None. Hence, requests do not time out.
from yotta.pod import PodApi
client = PodApi(timeout=1)
Display logs
Setting the log level to DEBUG will log the request URL, payload and response text.
Error
There are 2 types of error returned from the library:
yotta.error.ClientError- This is thrown when server returns
4XX, it's an issue from client side. - It has 5 properties:
status_code- HTTP status codeerror_code- Server's error code, e.g.10001error_message- Server's error message, e.g.Unknown order sent.header- Full response header.error_data* - Additional detailed data which supplements theerror_message.- *Only applicable on select endpoints, eg.
cancelReplace
- *Only applicable on select endpoints, eg.
- This is thrown when server returns
yotta.error.ServerError- This is thrown when server returns
5XX, it's an issue from server side.
- This is thrown when server returns
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yottactl-0.1.0.tar.gz.
File metadata
- Download URL: yottactl-0.1.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b041715fe418f8ccb1d64e019c3f177b3badd9de431f170ff835d55c609ce84
|
|
| MD5 |
f4bbba42b877b6523ee7f704988fd36d
|
|
| BLAKE2b-256 |
3e923c7e2738979d08eeb8a17ac537fd343a56593baa85d6e9f87596b6f2fa15
|
File details
Details for the file yottactl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: yottactl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0373a9586a1a2fac8f5450b7ab1d3364f36d09660b482df0aca0a86efd5ef4f
|
|
| MD5 |
78ba6d90dd2af822a863f209be7d91aa
|
|
| BLAKE2b-256 |
dd7a897d61c0058fdade95fa2b0d892e089ef0f7569381197ba7c47eca152c3d
|