Skip to main content

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.ini with 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 code
      • error_code - Server's error code, e.g. 10001
      • error_message - Server's error message, e.g. Unknown order sent.
      • header - Full response header.
      • error_data* - Additional detailed data which supplements the error_message.
        • *Only applicable on select endpoints, eg. cancelReplace
  • yotta.error.ServerError
    • This is thrown when server returns 5XX, it's an issue from server side.

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

yottactl-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

yottactl-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

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

Hashes for yottactl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4b041715fe418f8ccb1d64e019c3f177b3badd9de431f170ff835d55c609ce84
MD5 f4bbba42b877b6523ee7f704988fd36d
BLAKE2b-256 3e923c7e2738979d08eeb8a17ac537fd343a56593baa85d6e9f87596b6f2fa15

See more details on using hashes here.

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

Hashes for yottactl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0373a9586a1a2fac8f5450b7ab1d3364f36d09660b482df0aca0a86efd5ef4f
MD5 78ba6d90dd2af822a863f209be7d91aa
BLAKE2b-256 dd7a897d61c0058fdade95fa2b0d892e089ef0f7569381197ba7c47eca152c3d

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