Python
Official async Python SDK.
Install
bash
pip install servermeRequires Python 3.9+ and aiohttp.
Quick start
python
import asyncioasync def main(): async with ServerMe(authtoken="sm_live_...") as client: tunnels = await client.tunnels.list() requests = await client.inspect.list(tunnels[0].url)
for req in requests: print(f"{req.method} {req.path} -> {req.status_code}")
asyncio.run(main()) ```
Live traffic
python
async with ServerMe(authtoken="sm_live_...") as client:
async for req in client.inspect.subscribe(tunnel_url):
print(f"{req.method} {req.path} -> {req.status_code}")API keys
python
keys = await client.api_keys.list()
full_token, info = await client.api_keys.create("my-app")
await client.api_keys.delete(info.id)Error handling
python
try: await client.tunnels.list() except AuthError: print("Bad token") except RateLimitError as e: print(f"Retry in {e.retry_after}s") ```
Self-hosted
python
client = ServerMe(
authtoken="sm_live_...",
server_url="https://api.yourdomain.com",
)