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.4.tar.gz (21.9 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.4-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hakiapi-1.0.4.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hakiapi-1.0.4.tar.gz
Algorithm Hash digest
SHA256 4511df8dba9b099fc993d6dfd3fdacbe7e867adb8118c0ee34cc286ee5e9b43a
MD5 b2f88b23f6616ee51d07c8afa05a647b
BLAKE2b-256 b76f8da4215eccc83fbb91049a7af3554f1561625ed46f07636558cb3f255360

See more details on using hashes here.

Provenance

The following attestation bundles were made for hakiapi-1.0.4.tar.gz:

Publisher: release.yml on Gugilla-Aakash/hakiapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: hakiapi-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hakiapi-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6213ecde6cb457c6093d366e9716d8c0b5937ffb17fa6ef10955fd9b132f78e1
MD5 9dd9bf328beb0d1ff75eb59f01990d8b
BLAKE2b-256 b6a191c3757006f82e9ae41939ab9d1ccd2d25338b37a0092c27c7010cefa79f

See more details on using hashes here.

Provenance

The following attestation bundles were made for hakiapi-1.0.4-py3-none-any.whl:

Publisher: release.yml on Gugilla-Aakash/hakiapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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