Skip to main content

Async Kong client and cli (forked from aio-kong)

Project description

Async Python Client for Kong (exp fork of aio-kong)

Forked from aio-kong by Luca Sbardella.

For managing Kong using declarative configuration (yaml), over manual bookeeping of curls and/or resource state handling bash scripts.

Changes to the original:

  • Patch tests to pass with Kong 0.14.x and 1.0.0rc2
  • Added docker-compose stack for tests
  • Added make rules for flake8, test, build, publish_pypi, etc.
  • Added separate .venvs for dev and release, handled by make rules
  • Added (opinionated) pytest plugins for dev venv, to help myself
  • Added KADMIN_ env vars for using via Kong Admin API loopback with key-auth

TODO:

  • PR Kong 0.14.x to original if can make it compatible with 0.13
  • Consider adding an --option for creating Kong Admin API loopback service

Installation

On Python >= 3.6:

pip install --upgrade kong-incubator

Usage

CLI

Create or update the Kong resources according to configuration:

kong-incubator --yaml config.yaml

By default, target KONG_URL is http://127.0.0.1:8001.

Run kong-incubator for the list of options.

Python

from kong.client import Kong

async with Kong() as cli:
    services = await cli.services.get_list()
    print(json.dumps(services, indent=4))

Development

To create the docker-compose stack and run tests for it:

make test

Tests clean up the Kong resources they create. The docker volume for DB persists until make testdown or make clean is ran.

Run make for the list of rules.

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

kong-incubator-0.4.1.tar.gz (9.2 kB view hashes)

Uploaded Source

Built Distribution

kong_incubator-0.4.1-py2.py3-none-any.whl (11.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page