Version: | 0.34.0 |
---|---|
Source: | https://github.com/maykinmedia/zgw-consumers |
Keywords: | OpenAPI, Zaakgericht Werken, Common Ground, NLX |
Manage your external API's to consume.
Contents
- Store services with their configuration in the database
- Built in ape-pie API client adapter
- NLX support
- Declare data/domain objects as modern Python dataclasses
- Python 3.10 or newer
- Django 4.2 or newer
- Install from PyPI
pip install zgw-consumers
- Add
zgw_consumers
andsimple_certmanager
to theINSTALLED_APPS
setting.
In the Django admin, you can create Service
instances to define your external APIs.
Client
To get a client for a given resource, you can use:
from zgw_consumers.client import build_client
from zgw_consumers.models import Service
my_service = Service.objects.get(api_root="https://api.example.com/")
client = build_client(my_service)
with client:
# The preferred way to use the client is within a context manager
client.get("relative/url")
The resulting client will have certificate and authentication automatically configured from the database configuration.