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

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: xpawn-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 28011f9b310865fddd3e0b3b3efe37d35a52b56750ff782c2cb68db1f27cbc4d
MD5 3c1b3707abe08432774d2886cf716531
BLAKE2b-256 87c6026e3c3c3e50198f840469f69f60479a38c5cf99b3ab4ee541dd0a099f60

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpawn-0.2.2-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.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 29f5b33b3f2ad5d2a65791303b56783bd0da260944c7d0ae99c6c7704d237cd6
MD5 0adc84311c57214193cd7f0d5c5a616e
BLAKE2b-256 d9403911bc0cb81cbd513833cf3d38418db7ccc5ad504e08b1e9b517c831a532

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