A modern Python framework for building clean, typed, and extensible API clients.
Project description
HakiAPI
Build resilient Python API clients — not boilerplate.
A modern, typed, extensible framework for building production-ready API SDKs with automatic authentication, retries, pagination, and consistent error handling.
Installation • Quick Example • Features • Architecture • Roadmap
Why HakiAPI?
Every API client eventually implements the same things:
- Authentication
- Retry logic
- Pagination
- Session management
- Exception handling
HakiAPI provides these once, correctly, so you can focus on your API instead of rebuilding infrastructure.
Installation
pip install hakiapi
Quick Example
from hakiapi.clients.github import GitHubClient
github = GitHubClient()
user = github.get_user("torvalds")
print(user["login"])
Automatic pagination — no page counting, no manual while loops:
for repo in github.get_all_user_repos("torvalds"):
print(repo["name"])
Automatic retries and errors — failures surface as typed exceptions you can actually catch:
from hakiapi.core.exceptions import RateLimitError, ServerError
try:
user = github.get_user("torvalds")
except RateLimitError:
print("Rate limited — back off and retry later")
except ServerError:
print("GitHub is having issues, not your code")
No page counting. No retry handling. No authentication plumbing. Just Python.
Features
| 🔐 Multiple auth strategies | Bearer Token, API Key (Header), API Key (Query), HMAC |
| 🔁 Automatic retries | Configurable backoff that preserves typed exceptions instead of swallowing failures |
| 📄 Automatic pagination | Auto-detects GitHub-style Link headers and cursor/token APIs, iterated lazily |
| ⚠️ Rich exception hierarchy | RateLimitError, ServerError, and more — catch exactly what you expect |
🧱 Extensible BaseAPIClient |
Subclass it once, inherit auth/retry/pagination for free |
| 📦 Ready-to-use service clients | GitHub, Gmail included out of the box |
Architecture
GitHubClient,GmailClient
│
▼
BaseAPIClient
┌──────────────┬─────────┬──────────┐
│ │ │ │
Authentication Retry Pagination Exceptions
Each service client is a thin layer over BaseAPIClient — define your endpoints, and authentication, retries, and pagination come along automatically.
Project Structure
hakiapi/
├── core/
│ ├── auth.py
│ ├── retry.py
│ ├── paginator.py
│ ├── base_client.py
│ └── exceptions.py
│
└── clients/
├── github.py
├── gmail.py
Testing
pytest
- ✔ 210+ tests
- ✔ Full client coverage (GitHub, Gmail)
- ✔ Full core framework coverage (auth, retry, paginator, base client)
Roadmap
- Base API framework
- Retry engine
- Authentication system
- Automatic pagination
- GitHub client
- Gmail client
- Stripe client
- Twitter client
- Async client
- More API clients
Contributing
Pull requests are welcome. Please open an issue before proposing major changes so we can discuss the approach first.
License
MIT License — see LICENSE for details.
Built with ❤️ by Gugilla Aakash
If HakiAPI helps your project, consider giving it a ⭐
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hakiapi-1.1.0.tar.gz.
File metadata
- Download URL: hakiapi-1.1.0.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47b0bcd6f08435b77622427de41df365f18ff35430492bce643d5dac3199f0bb
|
|
| MD5 |
f3c0c447f9e574c03aa7e35c0f56e03f
|
|
| BLAKE2b-256 |
7119b334642916cf5649571b774ce96664bcc059a5288ea16d7e67f38b84c3c5
|
Provenance
The following attestation bundles were made for hakiapi-1.1.0.tar.gz:
Publisher:
release.yml on Gugilla-Aakash/hakiapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hakiapi-1.1.0.tar.gz -
Subject digest:
47b0bcd6f08435b77622427de41df365f18ff35430492bce643d5dac3199f0bb - Sigstore transparency entry: 2195009749
- Sigstore integration time:
-
Permalink:
Gugilla-Aakash/hakiapi@03d88cd2e1f714563f476bf6d6473f2be7bfbf3c -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/Gugilla-Aakash
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@03d88cd2e1f714563f476bf6d6473f2be7bfbf3c -
Trigger Event:
release
-
Statement type:
File details
Details for the file hakiapi-1.1.0-py3-none-any.whl.
File metadata
- Download URL: hakiapi-1.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c69174de8b80630b76ade1867ca97a24147b154a4234179b5ec5502e22099f3a
|
|
| MD5 |
166324f7fbb8863b084affd918c5edfd
|
|
| BLAKE2b-256 |
39ece9cd6da2353fedc1358912b5e5116664f49d8df7e8edc7cd7d61e0ed3e03
|
Provenance
The following attestation bundles were made for hakiapi-1.1.0-py3-none-any.whl:
Publisher:
release.yml on Gugilla-Aakash/hakiapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hakiapi-1.1.0-py3-none-any.whl -
Subject digest:
c69174de8b80630b76ade1867ca97a24147b154a4234179b5ec5502e22099f3a - Sigstore transparency entry: 2195009758
- Sigstore integration time:
-
Permalink:
Gugilla-Aakash/hakiapi@03d88cd2e1f714563f476bf6d6473f2be7bfbf3c -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/Gugilla-Aakash
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@03d88cd2e1f714563f476bf6d6473f2be7bfbf3c -
Trigger Event:
release
-
Statement type: