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 dataheaders: Contains HTTP headers, including tracking information likex_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
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
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d3a7862c9eddd7371b787799bb3964e82b2d25704de3e0afdb12e1ac5b19756
|
|
| MD5 |
76413b702c54ee6b8646bb124c3f8744
|
|
| BLAKE2b-256 |
3b2c023deccb32fdd5248ed6c2b63356f0deac95dd95762558b94570091877ea
|
Provenance
The following attestation bundles were made for webdock-1.0.3.tar.gz:
Publisher:
python-publish.yml on webdock-io/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
webdock-1.0.3.tar.gz -
Subject digest:
1d3a7862c9eddd7371b787799bb3964e82b2d25704de3e0afdb12e1ac5b19756 - Sigstore transparency entry: 438662435
- Sigstore integration time:
-
Permalink:
webdock-io/python-sdk@d1aaaf3515579db2bc8dc225e585af458ed26053 -
Branch / Tag:
refs/tags/1.0.3 - Owner: https://github.com/webdock-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d1aaaf3515579db2bc8dc225e585af458ed26053 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b04c967166bcbd6b4d766a0cc1c6904e2884944a934fb6ca1b03c4ef0c4b582c
|
|
| MD5 |
1f8ef281d570ef897023ecb2da2a9b18
|
|
| BLAKE2b-256 |
cf4729adfe7995f8f62bf31ee0bc129cbd2efad0a81eb86c019bcc60fb94d01a
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
webdock-1.0.3-py3-none-any.whl -
Subject digest:
b04c967166bcbd6b4d766a0cc1c6904e2884944a934fb6ca1b03c4ef0c4b582c - Sigstore transparency entry: 438662456
- Sigstore integration time:
-
Permalink:
webdock-io/python-sdk@d1aaaf3515579db2bc8dc225e585af458ed26053 -
Branch / Tag:
refs/tags/1.0.3 - Owner: https://github.com/webdock-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d1aaaf3515579db2bc8dc225e585af458ed26053 -
Trigger Event:
release
-
Statement type: