Template notice: This repository is a template. The package is named
exampleas a neutral placeholder. Before publishing, rename it to your own package name by search-and-replacingexampleacross the whole repository (directorysrc/example,pyproject.tomlname, imports, and tests).
A minimal Python SDK utility template that provides common building blocks for building Python SDKs: an HTTP client wrapper with auth, retry, and error handling.
For development (editable install):
pip install -e .To install the runtime dependencies only:
pip install ".[dev]" # includes pytest and ruff for development- API client utilities (
APIClient) with built-in retry and error handling - Authentication helpers (
BearerAuth,BasicAuth,ApiKeyAuth) - Automatic retry with exponential backoff + jitter (429 and 5xx)
- Typed error handling (
APIError,RateLimitError,AuthenticationError)
from example.client import APIClient
from example.auth import BearerAuth
# Create an authenticated client
client = APIClient(
base_url="https://api.example.com",
auth=BearerAuth("your_token_here"),
timeout=30,
)
# The client is also a context manager
with client:
# Make API requests with automatic retry and error handling
response = client.get("/endpoint", params={"key": "value"})
# Parse the response
data = response.json()
print(data)For full documentation, visit the project repository.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.