XPawn: A Python client for the XPawn API.
Project description
XPawn Python Client
A Python client library for interacting with the XPawn API.
Installation
pip install xpawn
Quick Start
from xpawn import xpawn
# Initialize the client
client = xpawn.Client(api_key='your-api-key')
# Get a prompt by ID
response = client.get_prompt('prompt-id')
print(response)
Configuration
Timeout
You can set a custom timeout (default is 30 seconds):
client = xpawn.Client(
api_key='your-api-key',
timeout=60
)
API Methods
get_prompt(prompt_id)
Retrieve a prompt by its ID.
Parameters:
prompt_id(str): The ID of the prompt to retrieve
Returns:
dict: The prompt data from the API
Example:
response = client.get_prompt('prompt-123')
health_check()
Perform a health check on the API.
Returns:
dict: Health check response
Example:
health = client.health_check()
Error Handling
The client raises XPawnAPIError for API-related errors:
from xpawn.client import XPawnAPIError
try:
response = client.get_prompt('invalid-id')
except XPawnAPIError as e:
print(f"API Error: {e}")
print(f"Status Code: {e.status_code}")
License
MIT 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
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 xpawn-0.2.1.tar.gz.
File metadata
- Download URL: xpawn-0.2.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76e60361cc96fedd3109633b95a424f25e77986d83c44025f173c782dd64ed12
|
|
| MD5 |
8c3e8b3865b7d8695fd10f3be53ecc5f
|
|
| BLAKE2b-256 |
4ec0e67c66c60a3de1d8688a9ef182cac16cd169d2b999cb4ec9a7b0ef3c688f
|
File details
Details for the file xpawn-0.2.1-py2.py3-none-any.whl.
File metadata
- Download URL: xpawn-0.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47f78093c52f5625b8ef2634163dab22b23f7fd8ecd7665a0aa79fe5440e1367
|
|
| MD5 |
bfc85e5b07d91dd67e3cb58a47dee636
|
|
| BLAKE2b-256 |
191b6ccb0107c4e0993e77a3d8b4c7296554e64a33a61e48abb6c2d9aca28eaa
|