Python SDK for LeaderGPU Public API
Project description
Unofficial LeaderGPU Python SDK
A Python library for interacting with the LeaderGPU Public API
Getting Started
- Install with pip:
pip install leadergpu-python
- Set the
LEADERGPU_CLIENT_ID(email) andLEADERGPU_AUTH_TOKEN(password) environment variable:
export LEADERGPU_CLIENT_ID="username@mail.org"
export LEADERGPU_AUTH_TOKEN="XXXXXX"
- Example for orderung a server:
import os
from leadergpu import LeaderGPUClient
CLIENT_ID = os.environ['LEADERGPU_CLIENT_ID']
CLIENT_SECRET = os.environ['LEADERGPU_AUTH_TOKEN']
leadergpu = LeaderGPUClient(CLIENT_ID, CLIENT_SECRET)
# Get all products
products = leadergpu.products.get()
# Filter out products that are available
free_products = [product for product in products if product.free_time == None]
# Sort products by price and get the product with the lowest price
free_product = sorted(free_products, key=lambda product: product.price)
# Print the available sorted by the lowest price
for product in free_product:
print(product)
# Order a the selected server, change the parameters accordingly example:
# product_id = 909
# os = 'ubuntu'
# period_count = 300
# Note the total cost has to be > 10 Euros, for a successful transaction
leadergpu.servers.order(product_id, os, period_count)
Examples
Checkout the /examples directory for more examples on how to use the Python SDK.
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
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 leadergpu-python-0.1.3.tar.gz.
File metadata
- Download URL: leadergpu-python-0.1.3.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ec2d217236ed8d51911b98d703656c0e29c693e9b5cc0727fea8d9d8fc6e3f2
|
|
| MD5 |
ef55d3698055c97dc6a8072bc8a0cec7
|
|
| BLAKE2b-256 |
f9036bd1c517eb3a82656b49780e2cd84f4b592fc2458adcf101d03908f1c27f
|
File details
Details for the file leadergpu_python-0.1.3-py3-none-any.whl.
File metadata
- Download URL: leadergpu_python-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd76a5499099fca7a7b70e6dc9e4f9eacb7c58e5fcd2053059701ef07843f914
|
|
| MD5 |
c7152df6afb6f42ae1faa582b9dcc004
|
|
| BLAKE2b-256 |
dbe5529a4e45bba116f16970dd659171e872046b573aa9484001c4948eb8939c
|