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.5.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.5-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hakiapi-1.0.5.tar.gz
  • Upload date:
  • Size: 22.1 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.5.tar.gz
Algorithm Hash digest
SHA256 9ce419ea454d32bd12e81c1c8c810d4429d226928efe4e4cf2e7f44a308557e2
MD5 bca7786b516399a4d6824c5b915e7ac1
BLAKE2b-256 fe97f16b57b938b7b6373f8032646913dc20ee3f45be65499b586b22af3b87bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for hakiapi-1.0.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: hakiapi-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.1 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7e0133a63b3cf345288fd79000e425f10105c98be57224e98dcf45c503ea74f9
MD5 eef42c80728322a6f0f3f1332b6ee1eb
BLAKE2b-256 496704fa1b23bfeee4ac3474c1c3e8da65446b140e74d144cb634779f33cd013

See more details on using hashes here.

Provenance

The following attestation bundles were made for hakiapi-1.0.5-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