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, Stripe, and Twitter included out of the box

Architecture

                GitHubClient
                TwitterClient
                StripeClient
                       │
                       ▼
                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
    ├── stripe.py
    └── twitter.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.1.tar.gz (22.2 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.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hakiapi-1.0.1.tar.gz
  • Upload date:
  • Size: 22.2 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.1.tar.gz
Algorithm Hash digest
SHA256 8f8a141fe2867c5185e43c76dee9582d4ec6d578a64c0f970050eeb7db4213a6
MD5 c7f2fd205cfb891e987671dad6871e56
BLAKE2b-256 1bfbd351e4c73ee7d78161f545fe4459b7908f16dd5fc6c65ea064cd053b06e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hakiapi-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ceb08979012649cfb1ad23efbfd2d133f1ab2e32e1fe7e78110a24722c8d1453
MD5 236943df37b270f62615d92bc895de1f
BLAKE2b-256 3ed9328856a994f79dfe724addacdc30672604f4427c953dc6229206fccfec07

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