Coming Soon: The official Python client library is currently in development. For now, you can use the REST API directly with requests or httpx.
What's Coming
Async Support
Both synchronous and asynchronous methods with proper type hints.
Easy Installation
Simple pip install with optional dependencies for async support.
Usage Preview
Here's what the Python client library will look like when it's ready:
# Installation pip install prompthub-client # Synchronous usage from prompthub import PromptHub client = PromptHub( api_key="pm-your-api-key-here", base_url="https://your-domain.com" ) # Get a prompt prompt = client.prompts.get("welcome_message") print(prompt.content) # Asynchronous usage import asyncio from prompthub import AsyncPromptHub async def main(): async with AsyncPromptHub( api_key="pm-your-api-key-here" ) as client: prompt = await client.prompts.get("welcome_message") print(prompt.content) asyncio.run(main())
Current Alternative
While we're working on the official client library, you can use the REST API directly:
# Using requests (synchronous) import requests def get_prompt(api_key, prompt_id): url = f"https://your-domain.com/api/v1/prompts/{prompt_id}" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } response = requests.get(url, headers=headers) response.raise_for_status() return response.json()["prompt"] # Usage prompt = get_prompt("pm-your-api-key-here", "welcome_message") print(prompt["content"]) # Using httpx (async support) import asyncio import httpx async def get_prompt_async(api_key, prompt_id): url = f"https://your-domain.com/api/v1/prompts/{prompt_id}" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } async with httpx.AsyncClient() as client: response = await client.get(url, headers=headers) response.raise_for_status() return response.json()["prompt"] # Usage prompt = await get_prompt_async("pm-your-api-key-here", "welcome_message") print(prompt["content"])
Get Notified
Want to be notified when the Python client library is ready?