Skip to main content

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.

PyPI Python License Tests

InstallationQuick ExampleFeaturesArchitectureRoadmap


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 included out of the box

Architecture

                GitHubClient
                       │
                       ▼
                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

Testing

pytest
  • ✔ 190+ tests
  • ✔ Full client coverage (GitHub, Stripe, Twitter)
  • ✔ Full core framework coverage (auth, retry, paginator, base client)

Roadmap

  • Base API framework
  • Retry engine
  • Authentication system
  • Automatic pagination
  • GitHub 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

hakiapi-1.0.2.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hakiapi-1.0.2-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file hakiapi-1.0.2.tar.gz.

File metadata

  • Download URL: hakiapi-1.0.2.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for hakiapi-1.0.2.tar.gz
Algorithm Hash digest
SHA256 5e1067bc66274b67d9e0011a12fa096c25703e2715f73f8bbd7db8859972c105
MD5 fa89b6e36da60fd2d588ed7ad5dcabaf
BLAKE2b-256 9c70e708ef97a94643293d1f631592e5812b52fb7140f44eb45046d20d001261

See more details on using hashes here.

File details

Details for the file hakiapi-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: hakiapi-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for hakiapi-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c80d464040f513cfeda159cac9ecd6299de7005bae1872f1cc362d6e1d4d559f
MD5 16a3e9c38583d34ca72340652486f25f
BLAKE2b-256 735ecc0f9ffc54d70d01ac0405ac936344cb075061f17cf4e2c3b506ac9420a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page