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.1.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.1.0-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: xpawn-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 8c4173f7a39f8f0e0fe12e16f91a57cfd38ca55ce2f30548d7747a36001b1a8d
MD5 68f8b3cb7c820269e164daa8e6ce00aa
BLAKE2b-256 c8c4842d6a80b27dfad2d501e9a42fe89191115689b98bff1fdb1f7581a69d39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpawn-0.1.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.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 07ed60ec092895de4f9bcfdd1de34932305118a6d1a04abf86f838ef6d22bc5f
MD5 8123f004a3a7e8a9040d8be2483ed8dc
BLAKE2b-256 f098a7bb82a3503b00cc1d0e95370b9a713dbc2e66ce6709a1a67ddb5d32659d

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