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.1.0.tar.gz
(13.3 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.1.0-py3-none-any.whl
(15.7 kB
view details)
File details
Details for the file wayscloud-0.1.0.tar.gz.
File metadata
- Download URL: wayscloud-0.1.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c54c51254c978f340f85db1b81b9cae2bb616d813b4b70515b069270f0b3d25
|
|
| MD5 |
cebfd4d529de006d1644b91cf8ff4c29
|
|
| BLAKE2b-256 |
8c134372aed27656e5aed1ab49c6717b97f6785011e25d12e8b62b138099035f
|
File details
Details for the file wayscloud-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wayscloud-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.7 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 |
35667ca3638dd1e6f9cdaefc42e599902bccc07d6a66da59694b061ad514daf2
|
|
| MD5 |
0824f4a158bf3283b9aaa78ba9b4a44d
|
|
| BLAKE2b-256 |
19a751ec012db8cd07b5db93ae310927e2eb67460107a656576388a2c755039f
|