Skip to main content

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

xpawn-0.2.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

xpawn-0.2.0-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: xpawn-0.2.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.4

File hashes

Hashes for xpawn-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2c5f7fa656c4ade069407abe5f59cd32978331279437cdbf2cd512111e3bfeec
MD5 b23433787873a5b24ab39ceadadbc713
BLAKE2b-256 209fb780183016cda77427ad851c154a34da54ab93365ca8300bb4c80f760a0b

See more details on using hashes here.

File details

Details for the file xpawn-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: xpawn-0.2.0-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

Hashes for xpawn-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bb0836bc741ec68651d055ed5372538b0a14c3d6c8c28a475b8e67230a51e9d7
MD5 76c2207f1d25522ed8712e6ded65305d
BLAKE2b-256 76631903e293a6736f4a8955462210b37d4ee1375d7f01bde940a6ec336337a2

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