sdk
All apps

Python SDK

PyPI

Sync and async client with type annotations and retry backoff

Gallery

About

Modern Python library supporting both synchronous and asynchronous (asyncio/httpx) execution. Published on PyPI with full typing hints and Pydantic models.

Features

  • Dual sync and async clients (`Client` and `AsyncClient`)
  • Pydantic-validated response payloads and strict typing
  • Built-in token bucket rate limiting and retry handling
  • Export link batches and analytics data directly to pandas DataFrame

Code Quickstart

example.pypython
import asyncio
from shaf import AsyncShafClient

async def main():
    async with AsyncShafClient(api_key="your-api-key") as client:
        link = await client.create_link(
            url="https://docs.shaf.app",
            alias="documentation",
            tags=["engineering", "v2"],
        )
        print(f"Created link: {link.short_url}")

asyncio.run(main())