Skip to main content

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)

Uploaded Source

Built Distribution

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

wayscloud-0.3.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

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

Hashes for wayscloud-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b081dc5285162d5bc191141c98e39c2c0d7171144c5af4269709f18878faf445
MD5 d8cade1d1d580dd44861d0da52bd27c4
BLAKE2b-256 a0d1a5784b7fe4b708ebd019878eeddebdf4b96f01ab3f4af909d0a92f75ef9e

See more details on using hashes here.

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

Hashes for wayscloud-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b10680d495c753f3b8dfe47a3a7e82abdc1e5376996fb3f1470931a60f28634a
MD5 9d435fd52749aba760d0aaa9e37344a8
BLAKE2b-256 c9142feb308b24f833d46770fe5c9555e8a4f3dcdb26c7c7608ca1c5df1d5977

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