Skip to main content

A type-safe Python wrapper for the Webdock.io API.

Project description

Webdock API Python SDK

A type-safe Python wrapper for the Webdock.io API.

Documentation

Full API documentation is available at api.webdock.io

Installation

pip install webdock

Quick Start

Each operation returns both body and headers that you can access using the get() method:

import time
from webdock import webdock
from requests import RequestException

def main():
    # Initialize client with your API token
    client = webdock.Webdock("your_api_token_here")
    
    try:
        # Create a new server
        server = client.servers.create(
            imageSlug="ubuntu-20-04-x64",
            locationId="pl-waw",
            name="test-server",
            profileSlug="s-1vcpu-1gb",
        )
        
        # Access server data from response body
        aliases = server.get("body").get("aliases")
        print(f"Server aliases: {aliases}")
        
        # Access callback ID from headers to track provision operation state
        callback_id = server.get("headers").get("x_callback_id")
        print(f"Callback ID: {callback_id}")
        
    except RequestException as e:
        print(f"API request failed: {e}")

if __name__ == "__main__":
    main()

Response Structure

All API operations return a response object with two main components:

  • body: Contains the actual API response data
  • headers: Contains HTTP headers, including tracking information like x_callback_id

Example Usage

# Get server information
server_info = server.get("body")
server_name = server_info.get("name")
server_status = server_info.get("status")

# Track operations using headers
callback_id = server.get("headers").get("x_callback_id")

Backward Compatibility

The legacy package is still available but deprecated. You can import it for existing projects:

import time
from oldwebdock.webdock import Webdock
from requests import RequestException

def main():
    client = Webdock("your_api_token_here")
    
    try:
        # Create webhook (legacy syntax)
        webhook = client.create_hook(
            hookType="foo",
            hookValue="https://your-webhook-url.com"
        )
        
        # Access response data (same pattern as new SDK)
        webhook_id = webhook.get("body").get("id")
        callback_id = webhook.get("headers").get("x_callback_id")
        
    except RequestException as e:
        print(f"Request failed: {e}")

if __name__ == "__main__":
    main()

⚠️ Deprecation Notice: legacy package is now deprecated. Please migrate to the new SDK for continued support and updates.

Features

  • Type-safe: Full type hints for better IDE support and error catching
  • Easy to use: Simple, intuitive API interface
  • Error handling: Built-in exception handling with detailed error messages
  • Async support: Non-blocking operations for better performance
  • Comprehensive: Full coverage of Webdock API endpoints

Support

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

webdock-1.0.3.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

webdock-1.0.3-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file webdock-1.0.3.tar.gz.

File metadata

  • Download URL: webdock-1.0.3.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for webdock-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1d3a7862c9eddd7371b787799bb3964e82b2d25704de3e0afdb12e1ac5b19756
MD5 76413b702c54ee6b8646bb124c3f8744
BLAKE2b-256 3b2c023deccb32fdd5248ed6c2b63356f0deac95dd95762558b94570091877ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for webdock-1.0.3.tar.gz:

Publisher: python-publish.yml on webdock-io/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file webdock-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: webdock-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for webdock-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b04c967166bcbd6b4d766a0cc1c6904e2884944a934fb6ca1b03c4ef0c4b582c
MD5 1f8ef281d570ef897023ecb2da2a9b18
BLAKE2b-256 cf4729adfe7995f8f62bf31ee0bc129cbd2efad0a81eb86c019bcc60fb94d01a

See more details on using hashes here.

Provenance

The following attestation bundles were made for webdock-1.0.3-py3-none-any.whl:

Publisher: python-publish.yml on webdock-io/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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