Skip to main content

Reusable API integration utility for Django services

Project description

django-api-utility

Reusable API integration utility for Django services.

Features

  • Service + endpoint registry models
  • Definition-key based endpoint resolution
  • OAuth token fetch/refresh flow with encrypted token storage
  • Consistent utility exceptions for config, token, and request errors
  • Thin request wrapper with retry support

Install

pip install -e .

Django setup

Add app:

INSTALLED_APPS = [
    # ...
    "django_api_utility",
]

Definition key mapping

Provide a JSON mapping file via EXTERNAL_DEFINITION_KEYS_FILE, or use the packaged default at config/external_definition_keys.json.

Example:

{
  "users_get": "service_users_get"
}

Usage

from django_api_utility import get_by_key, post_by_key

response = get_by_key("users_get", params={"page": 1})
create_response = post_by_key("users_create", payload={"name": "Alice"})

Internal layout

  • django_api_utility/transport/: HTTP transport and outbound execution primitives
  • django_api_utility/domain/: definition keys, endpoint resolution, token lifecycle
  • django_api_utility/orchestration/: request orchestration with retries and token refresh fallback

Tests

pip install -e ".[test]"
pytest -q

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_api_utility-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

django_api_utility-0.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_api_utility-0.1.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for django_api_utility-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d6c36126d3bdc941d2a6753e5723e864afff918292457b736c0af8685c7648c
MD5 f7634c5a80a767a3570114aff5b165c0
BLAKE2b-256 eec299e7f3d444cc58728283f7f079e574de9f21f198d67b9340426ced1185f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_api_utility-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c111582bb86684a254bb0fcf410823f863576d830a45645a7b794b1d41e756f8
MD5 ead72bf4b6c6f9cce4f61fc0539d2c6a
BLAKE2b-256 e6bf7029305a0bccbb02db1d7c7761df86e121489d151ea37cd5e1b08a9a50fc

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