Skip to main content

Reusable Django app to call KRA GavaConnect APIs (sandbox & production).

Project description

DJANGO-GAVACONNECT

gavaconnect is a reusable Django app that provides a simple and standardized interface for integrating with the GavaConnect KRA APIs (Kenya Revenue Authority), supporting both sandbox and production modes.

It allows you to easily connect to KRA services such as:

  • PIN Checker (by PIN)
  • PIN Checker (by National ID)
  • IT (Income Tax) Exemption Checker
  • VAT Exemption Checker
  • PRN Search from iTax

Features

  • Easy to install and configure in any Django project
  • Sandbox and production environment support
  • Centralized API authentication
  • Clean exception handling
  • Built-in self-test management command
  • Type hints for better IDE support

Installation

pip install gavaconnect

Or install from source:

git clone https://github.com/mworia-Br/gavaconnect.git
cd gavaconnect
pip install .

Configuration

In your Django settings:

GAVACONNECT = {
    "MODE": "sandbox",  # or "production"
    "CLIENT_ID": "your_client_id",
    "CLIENT_SECRET": "your_client_secret",
    "BASE_URL_SANDBOX": "https://sandbox.gavaconnect.co.ke/api",
    "BASE_URL_PRODUCTION": "https://api.gavaconnect.co.ke/api",
}

Usage

PIN Checker by PIN

from gavaconnect.api import pin_checker_by_pin

result = pin_checker_by_pin("A123456789B")
print(result)

PIN Checker by National ID

from gavaconnect.api import pin_checker_by_id

result = pin_checker_by_id("12345678")
print(result)

IT Exemption Checker

from gavaconnect.api import it_exemption_checker

result = it_exemption_checker("A123456789B")
print(result)

VAT Exemption Checker

from gavaconnect.api import vat_exemption_checker

result = vat_exemption_checker("A123456789B")
print(result)

Search PRN from iTax

from gavaconnect.api import search_prn

result = search_prn("PRN123456789")
print(result)

Running Self-Test

python manage.py gavaconnect_selftest

This will:

  • Test connectivity to GavaConnect
  • Check authentication
  • Validate sample API requests

Running Tests

pytest

License

This project is licensed under the MIT License – see the LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Create a Pull Request

Author

Brian Nganga
GitHub | LinkedIn

Disclaimer

This package is not affiliated with or endorsed by Gava Connect. Use it at your own risk.

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

django_gavaconnect-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

django_gavaconnect-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file django_gavaconnect-0.1.0.tar.gz.

File metadata

  • Download URL: django_gavaconnect-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for django_gavaconnect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 22d4f0146b9114bf22d3a000508198571d10fe33e3406e375ab531b875a276b3
MD5 0bea618e802be5f788e34a395bab5cfe
BLAKE2b-256 08329b94977e8a93ff150cf89333857b9212289cbf3df723f36fca6457311b60

See more details on using hashes here.

File details

Details for the file django_gavaconnect-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_gavaconnect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5abb8f3d1a78b14aeb1f42d5692a72bc478d72206d2af4bf15c07865905ff35
MD5 f0676ac87009db29ab687bb23a1d0051
BLAKE2b-256 a111d34a6eefb7b209a898b6e82ebd1bcca5830016d79ee6e4a1e8fe323495be

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