CubePath Cloud API Python SDK
Project description
CubePath Python SDK
Official Python SDK for the CubePath Cloud API.
Installation
pip install cubepath
Quick Start
import cubepath
client = cubepath.CubePathClient(api_token="your-api-token")
# List projects
projects = client.projects.list()
for p in projects:
print(p.project.name)
# Create a VPS
from cubepath.models import CreateVPSRequest
req = CreateVPSRequest(
name="my-vps",
plan_name="gp.nano",
template_name="debian-12",
location_name="us-mia-1",
ssh_key_names=["my-key"],
)
task = client.vps.create(project_id="proj-123", req=req)
print(f"Task: {task.task_id}")
Services
| Service | Access | Description |
|---|---|---|
| Projects | client.projects |
Manage projects |
| SSH Keys | client.ssh_keys |
Manage SSH keys |
| VPS | client.vps |
Virtual private servers |
| VPS Backups | client.vps.backups() |
VPS backup management |
| VPS ISOs | client.vps.isos() |
ISO mount/unmount |
| Baremetal | client.baremetal |
Bare metal servers |
| Networks | client.networks |
Private networks |
| Floating IPs | client.floating_ips |
Floating IP addresses |
| Firewall | client.firewall |
Firewall groups & rules |
| DNS | client.dns |
DNS zones & records |
| Load Balancer | client.load_balancer |
Load balancers, listeners, targets |
| CDN | client.cdn |
CDN zones, origins, rules, WAF |
| Kubernetes | client.kubernetes |
K8s clusters, node pools, addons |
| Pricing | client.pricing |
Pricing information |
| DDoS | client.ddos |
DDoS attack reports |
Configuration
client = cubepath.CubePathClient(
api_token="your-api-token",
base_url="https://api.cubepath.com", # default
timeout=30.0, # seconds
max_retries=3, # retry on 429/5xx
retry_wait_min=1.0, # min backoff seconds
retry_wait_max=30.0, # max backoff seconds
rate_limit_interval=0.1, # 10 req/s
)
Context Manager
with cubepath.CubePathClient(api_token="tok") as client:
zones = client.dns.list_zones()
Error Handling
from cubepath import APIError, is_not_found
try:
project = client.projects.get("nonexistent")
except APIError as e:
if e.is_not_found():
print("Project not found")
elif e.is_rate_limited():
print("Rate limited, try again later")
else:
print(f"API error: {e}")
Requirements
- Python >= 3.10
- httpx >= 0.27
Examples
Deploy a Baremetal Server
from cubepath.models import CreateBaremetalRequest
req = CreateBaremetalRequest(
model_name="c1.metal.plus",
location_name="us-mia-1",
hostname="db-server",
password="SecurePass123!",
os_name="debian-12",
ssh_key_names=["my-key"],
)
task = client.baremetal.deploy(project_id="proj-123", req=req)
Create a Load Balancer
from cubepath.models import CreateLoadBalancerRequest, CreateListenerRequest
lb = client.load_balancer.create(CreateLoadBalancerRequest(
name="web-lb",
plan_name="lb.small",
location_name="us-mia-1",
))
client.load_balancer.create_listener(lb.uuid, CreateListenerRequest(
name="http",
protocol="http",
source_port=80,
target_port=8080,
algorithm="round_robin",
))
Create a CDN Zone
from cubepath.models import CreateCDNZoneRequest, CreateCDNOriginRequest
zone = client.cdn.create_zone(CreateCDNZoneRequest(
name="my-site",
plan_name="cdn.starter",
custom_domain="cdn.example.com",
))
client.cdn.create_origin(zone.uuid, CreateCDNOriginRequest(
name="primary-origin",
address="origin.example.com",
port=443,
protocol="https",
weight=100,
priority=1,
health_check_path="/health",
))
DNS Management
from cubepath.models import CreateDNSZoneRequest, CreateDNSRecordRequest
zone = client.dns.create_zone(CreateDNSZoneRequest(domain="example.com"))
client.dns.create_record(zone.uuid, CreateDNSRecordRequest(
name="@",
record_type="A",
content="203.0.113.10",
ttl=3600,
))
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 cubepath_sdk-0.1.0.tar.gz.
File metadata
- Download URL: cubepath_sdk-0.1.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7462da64ae39648842a4ef0b2b2eaf1912f0a982d4c818f008387ab1904f2a2a
|
|
| MD5 |
2d74fae81f5520b3f7a1bdf9d19f12e0
|
|
| BLAKE2b-256 |
3e732b95676d79affb59f7ff731c68e7111f9ffce196b4aba95b96a58e8694d7
|
Provenance
The following attestation bundles were made for cubepath_sdk-0.1.0.tar.gz:
Publisher:
release.yml on CubePathInc/cubepath-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cubepath_sdk-0.1.0.tar.gz -
Subject digest:
7462da64ae39648842a4ef0b2b2eaf1912f0a982d4c818f008387ab1904f2a2a - Sigstore transparency entry: 1191482568
- Sigstore integration time:
-
Permalink:
CubePathInc/cubepath-python-sdk@31aeea3361bdbc0055446766897c282f4737c7ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CubePathInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@31aeea3361bdbc0055446766897c282f4737c7ec -
Trigger Event:
push
-
Statement type:
File details
Details for the file cubepath_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cubepath_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 31.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c9705c441077fbc015e4bc5d8dddf6aefd1911e27365c837327f5c183640747
|
|
| MD5 |
37f607f05e85824f1c535285a523d3ca
|
|
| BLAKE2b-256 |
bf3eda87121d0bcef2fc798583f2a70fa1b530e57c2ba99aaaf06a588bac57b4
|
Provenance
The following attestation bundles were made for cubepath_sdk-0.1.0-py3-none-any.whl:
Publisher:
release.yml on CubePathInc/cubepath-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cubepath_sdk-0.1.0-py3-none-any.whl -
Subject digest:
9c9705c441077fbc015e4bc5d8dddf6aefd1911e27365c837327f5c183640747 - Sigstore transparency entry: 1191482571
- Sigstore integration time:
-
Permalink:
CubePathInc/cubepath-python-sdk@31aeea3361bdbc0055446766897c282f4737c7ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CubePathInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@31aeea3361bdbc0055446766897c282f4737c7ec -
Trigger Event:
push
-
Statement type: