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.2.0.tar.gz (14.2 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.2.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file wayscloud-0.2.0.tar.gz.

File metadata

  • Download URL: wayscloud-0.2.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for wayscloud-0.2.0.tar.gz
Algorithm Hash digest
SHA256 829f8065a03e8e19cdcd1f062eae30ccb5983d26dbe9c82694ca1e4bf39f4c9f
MD5 b639769c26ccc7f1bc84f791c1ac295c
BLAKE2b-256 f4273d85500cbb0f93bf69ecd7431476678c3f87e2d5e20a1a97225e890b346d

See more details on using hashes here.

File details

Details for the file wayscloud-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: wayscloud-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8374d9d78f758c621b669bf8a69f30a0fa75e736b861fe9ad68e972b209b5f14
MD5 1082ea6a3608a454ea8f7e45f5b31dcb
BLAKE2b-256 33fbee03362b4c3bced432a56e416567be314b05451951fa789e665775225f23

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