Tested with kong v3.8
To install the package
pip install aio-kong
To run tests, clone and
make test
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'
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=2))
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.certificates CRUD operations on TLS certificates
- cli.snis CRUD operations on SNIs
cli.acls
To list all ACLs
The client allow to apply a configuration object to kong:
await cli.apply_json(config)
The library install the kongfig
command line tool for uploading kong configuration files.
kongfig --yaml config.yaml