Official Python SDK for the WAYSCloud API
Project description
WAYSCloud Python SDK
Official Python SDK for the WAYSCloud API.
Installation
pip install wayscloud
Authentication
from wayscloud import WaysCloudClient
# Personal Access Token
client = WaysCloudClient(token="wayscloud_pat_...")
# API key
client = WaysCloudClient(api_key="wayscloud_api_...")
# Environment variables (WAYSCLOUD_TOKEN or WAYSCLOUD_API_KEY)
client = WaysCloudClient()
Priority: explicit arguments > environment variables.
Usage
# VPS
for vm in client.vps.list():
print(vm["hostname"], vm["status"])
# DNS
client.dns.create_record(
"example.com",
record_type="A",
name="www",
value="192.0.2.1",
)
# Database
db = client.database.create(name="prod", db_type="postgresql")
# Apps
app = client.apps.create(name="my-app", region="eu")
# Storage
client.storage.create_bucket("my-bucket")
# SMS
client.sms.send(to="+4712345678", message="Hello from WAYSCloud")
Error handling
from wayscloud import NotFoundError, AuthenticationError
try:
client.vps.get("id")
except NotFoundError:
print("Not found")
except AuthenticationError:
print("Invalid credentials")
All exceptions inherit from WaysCloudError.
Configuration
| Parameter | Environment variable | Default |
|---|---|---|
token |
WAYSCLOUD_TOKEN |
— |
api_key |
WAYSCLOUD_API_KEY |
— |
base_url |
WAYSCLOUD_API_URL |
https://api.wayscloud.services |
timeout |
— | 30.0 |
Retries
Automatic retries on 429, 502, 503, 504 with exponential backoff. Respects Retry-After headers.
Requirements
- Python 3.10+
- httpx
License
MIT — see LICENSE.
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
wayscloud-0.3.0.tar.gz
(16.6 kB
view details)
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
wayscloud-0.3.0-py3-none-any.whl
(19.3 kB
view details)
File details
Details for the file wayscloud-0.3.0.tar.gz.
File metadata
- Download URL: wayscloud-0.3.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b081dc5285162d5bc191141c98e39c2c0d7171144c5af4269709f18878faf445
|
|
| MD5 |
d8cade1d1d580dd44861d0da52bd27c4
|
|
| BLAKE2b-256 |
a0d1a5784b7fe4b708ebd019878eeddebdf4b96f01ab3f4af909d0a92f75ef9e
|
File details
Details for the file wayscloud-0.3.0-py3-none-any.whl.
File metadata
- Download URL: wayscloud-0.3.0-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b10680d495c753f3b8dfe47a3a7e82abdc1e5376996fb3f1470931a60f28634a
|
|
| MD5 |
9d435fd52749aba760d0aaa9e37344a8
|
|
| BLAKE2b-256 |
c9142feb308b24f833d46770fe5c9555e8a4f3dcdb26c7c7608ca1c5df1d5977
|