Metadata-Version: 2.4
Name: zgw-consumers
Version: 2.0.1
Summary: Configuration for service (OpenAPI 3 or other) consumers
Author-email: Maykin Media <support@maykinmedia.nl>
License: Copyright 2022 Maykin Media
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/maykinmedia/zgw-consumers
Project-URL: Documentation, https://zgw-consumers.readthedocs.io/en/latest/
Project-URL: Bug Tracker, https://github.com/maykinmedia/zgw-consumers/issues
Project-URL: Source Code, https://github.com/maykinmedia/zgw-consumers
Project-URL: Changelog, https://github.com/maykinmedia/zgw-consumers/blob/main/CHANGELOG.rst
Keywords: Django,ZGW,Common Ground,VNG,API,OpenAPI,OAS,mTLS
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: django>=5.2
Requires-Dist: django-relativedelta>=2.0.0
Requires-Dist: django-solo
Requires-Dist: django-privates>=4.0.2
Requires-Dist: django-simple-certmanager>=4.0.0
Requires-Dist: requests
Requires-Dist: ape-pie
Requires-Dist: typing_extensions>=4.5.0
Requires-Dist: PyJWT>=2.0.1
Provides-Extra: db
Requires-Dist: psycopg; extra == "db"
Provides-Extra: drf
Requires-Dist: djangorestframework; extra == "drf"
Provides-Extra: oauth2
Requires-Dist: requests-oauthlib; extra == "oauth2"
Provides-Extra: setup-configuration
Requires-Dist: django-setup-configuration>=0.6.0; extra == "setup-configuration"
Provides-Extra: testutils
Requires-Dist: Faker>=0.7.0; extra == "testutils"
Requires-Dist: factory-boy; extra == "testutils"
Provides-Extra: tests
Requires-Dist: pytest; extra == "tests"
Requires-Dist: pytest-django; extra == "tests"
Requires-Dist: requests-mock; extra == "tests"
Requires-Dist: pytest-cov; extra == "tests"
Requires-Dist: freezegun; extra == "tests"
Requires-Dist: tox; extra == "tests"
Requires-Dist: ruff; extra == "tests"
Requires-Dist: tabulate; extra == "tests"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Provides-Extra: release
Requires-Dist: bump-my-version; extra == "release"
Dynamic: license-file

.. zgw_consumers documentation master file, created by startproject.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to ZGW Consumers' documentation!
========================================

:Version: 2.0.1
:Source: https://github.com/maykinmedia/zgw-consumers
:Keywords: OpenAPI, Zaakgericht Werken, Common Ground, NLX

|build-status| |coverage| |linting| |docs|

|python-versions| |django-versions| |pypi-version|

Manage your external API's to consume.

.. contents::

.. section-numbering::

Features
========

* Store services with their configuration in the database
* Built in `ape-pie <https://pypi.org/project/ape-pie/>`_ API client adapter
* NLX support
* Declare data/domain objects as modern Python dataclasses

Installation
============

Requirements
------------

* Python 3.10 or newer
* Django 4.2 or newer


Install
-------

1. Install from PyPI

.. code-block:: bash

    pip install zgw-consumers

2. Add ``zgw_consumers`` and ``simple_certmanager`` to the ``INSTALLED_APPS`` setting.

Usage
=====

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:

.. code-block:: python

    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.

.. |build-status| image:: https://github.com/maykinmedia/zgw-consumers/workflows/Run%20CI/badge.svg
    :target: https://github.com/maykinmedia/zgw-consumers/actions?query=workflow%3A%22Run+CI%22
    :alt: Run CI

.. |linting| image:: https://github.com/maykinmedia/zgw-consumers/workflows/Code%20quality%20checks/badge.svg
    :target: https://github.com/maykinmedia/zgw-consumers/actions?query=workflow%3A%22Code+quality+checks%22
    :alt: Code linting

.. |coverage| image:: https://codecov.io/gh/maykinmedia/zgw-consumers/branch/main/graph/badge.svg
    :target: https://codecov.io/gh/maykinmedia/zgw-consumers
    :alt: Coverage status

.. |docs| image:: https://readthedocs.org/projects/zgw-consumers/badge/?version=latest
    :target: https://zgw-consumers.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. |python-versions| image:: https://img.shields.io/pypi/pyversions/zgw_consumers.svg

.. |django-versions| image:: https://img.shields.io/pypi/djversions/zgw_consumers.svg

.. |pypi-version| image:: https://img.shields.io/pypi/v/zgw_consumers.svg
    :target: https://pypi.org/project/zgw_consumers/
