Async Python Client for Kong
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
make servicestest 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 KongIn a coroutine:
async with Kong() as cli:
services = await cli.services.get_list()
print(json.dumps([s.data for s in services], indent=4))The client has handlers for all Kong objects
cli.servicesCRUD operations on servicescli.routesCRUD operations on routescli.pluginsCRUD operations on pluginscli.consumersCRUD operations on consumerscli.consumersCRUD operations on consumerscli.certificatesCRUD operations on TLS certificatescli.snisCRUD operations on SNIscli.aclsTo 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