Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Asynchronous Kong client

Project description

Async Python Client for Kong

PyPI version Python versions Build codecov

Tested with kong v2.0

Installation & Testing

To install the package

pip install aio-kong

To run tests, clone and

./dev/install.sh
pytest --cov

:warning: If you don't have Kong or postgres running locally, run the services first

make services

test certificates were generated using the command

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=localhost'

Client

The client can be imported via

from kong.client import Kong

In a coroutine:

async with Kong() as cli:
    services = await cli.services.get_list()
    print(json.dumps([s.data for s in services], indent=4))

By default the url is obtained from the "KONG_ADMIN_URL" environment variable which defaults to http://127.0.0.1:8001.

The client has handlers for all Kong objects

  • cli.services CRUD operations on services
  • cli.routes CRUD operations on routes
  • cli.plugins CRUD operations on plugins
  • cli.consumers CRUD operations on consumers
  • cli.consumers CRUD operations on consumers
  • cli.certificates CRUD operations on TLS certificates
  • cli.snis CRUD operations on SNIs
  • cli.acls To list all ACLs

Apply a configuration

The client allow to apply a configuration object to kong:

await cli.apply_json(config)

Command line tool

The library install the kongfig command line tool for uploading kong configuration files.

kongfig --yaml config.yaml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aio-kong, version 0.8.2
Filename, size File type Python version Upload date Hashes
Filename, size aio_kong-0.8.2-py36-none-any.whl (12.7 kB) File type Wheel Python version py36 Upload date Hashes View
Filename, size aio_kong-0.8.2-py37-none-any.whl (12.7 kB) File type Wheel Python version py37 Upload date Hashes View
Filename, size aio_kong-0.8.2-py38-none-any.whl (12.7 kB) File type Wheel Python version py38 Upload date Hashes View
Filename, size aio_kong-0.8.2-py39-none-any.whl (12.7 kB) File type Wheel Python version py39 Upload date Hashes View
Filename, size aio-kong-0.8.2.tar.gz (21.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page