Python SDK
The official Python SDK provides typed methods for all API endpoints.
Installation
Section titled “Installation”pip install weplaytestgamesQuick Start
Section titled “Quick Start”from weplaytestgames import WPGClient
client = WPGClient(api_key="wpg_sk_...")
# List your gamesgames = client.games.list()
# Create a playtestplaytest = client.playtests.create( game_id="game_abc123", visibility="private", quantity=3, instructions="Focus on the tutorial",)
# Check credit balancebalance = client.billing.get_balance()print(f"Balance: ${balance.balance_cents / 100}")Authentication
Section titled “Authentication”import osfrom weplaytestgames import WPGClient
client = WPGClient( api_key=os.environ["WPG_API_KEY"], # Optional: custom base URL base_url="https://app.weplaytestgames.com/api/v1",)Error Handling
Section titled “Error Handling”from weplaytestgames import WPGClient, WPGError
try: client.playtests.create("game_abc", visibility="private", quantity=1)except WPGError as e: print(e.code) # "PAYMENT_REQUIRED" print(e.message) # "Insufficient credit" print(e.status) # 402Pagination
Section titled “Pagination”# Iterate all pagesfor game in client.games.list(): print(game.name)
# Get a single pagepage = client.games.list(limit=10)print(page.data)print(page.meta.has_more)Async Support
Section titled “Async Support”from weplaytestgames import AsyncWPGClient
client = AsyncWPGClient(api_key="wpg_sk_...")
games = await client.games.list()Available Methods
Section titled “Available Methods”| Namespace | Methods |
|---|---|
client.auth | me(), update_profile(), categories(), devices(), platforms() |
client.games | list(), create(), get(), update() |
client.playtests | create(), list(), get(), update(), slots() |
client.slots | get(), accept(), reject(), download_url(), transcript() |
client.playtester | profile(), update_profile(), stats(), open_playtests(), my_playtests() |
client.billing | get_balance(), payments(), purchase_credit() |
client.payouts | list(), quote(), request(), cancel() |
client.chat | contacts(), conversation(), send_message(), unread_count() |
client.webhooks | list(), create(), update(), delete(), deliveries(), test() |