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="foo",
            locationId="foo",
            name="test-server",
            profileSlug="foo",
        )
        
        # 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"
        )
    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.4.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.4-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: webdock-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 505b1e233613bdb23714ca5293df198efe0d8fff1affc505bfcdf2efced7ed5c
MD5 ed34f6111e31f3f597856276171b2bf6
BLAKE2b-256 83a0cef30c7a43aeb071810f7a9e26c2066b10c9c1b9ca57316ee677827f6063

See more details on using hashes here.

Provenance

The following attestation bundles were made for webdock-1.0.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: webdock-1.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ee836077ee2c8c00a46145871981c79259c395081b86097ca535220afea4e322
MD5 80206283578efc8f3cf117ec02f0943f
BLAKE2b-256 86553cc6f5392321efbafd345faf3a8cbc2c11a2cd8bafec665544594bc8f247

See more details on using hashes here.

Provenance

The following attestation bundles were made for webdock-1.0.4-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