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.1.tar.gz (20.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_api_utility-0.1.1-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_api_utility-0.1.1.tar.gz
  • Upload date:
  • Size: 20.6 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.1.tar.gz
Algorithm Hash digest
SHA256 02fecb403c01f738dd3da54da3e258574bffff18b01b40d08dd82b004033212e
MD5 9a98acecda36d5ced58a464fdbf3a975
BLAKE2b-256 31e17471ce7324f982ae80065cc695bebc00b2d53579607a6f2e7552d8bc743c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_api_utility-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ec9adcfd3dd2a7563cee3c7dc545c6dd3fdf7ab83c652ee1e02deb3c2d10e020
MD5 a529f7b393facd78b939de7c41a73f42
BLAKE2b-256 f05ea86bee5d8920e8b40a93765cf0bcc0b5a968f1fc4cf964a79fa8ce4215f2

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