🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

aio-kong

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aio-kong

Asynchronous Kong Client

3.7.2
PyPI
Maintainers
1

Async Python Client for Kong

PyPI version Python versions Build codecov Downloads

Tested with kong v3.8

Installation

To install the package

pip install aio-kong

Testing

To run tests, clone the repository and

make install
make test

: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=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

Apply a configuration

The client allow to apply a configuration object to kong:

await cli.apply_json(config)

Command line tool

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

For the command line tool to work, you need to install the package as:

pip install aio-kong[cli]

and to run the cli tool, you can use the following command:

kongfig --help

Environment variables

The client uses the following environment variables:

  • KONG_ADMIN_URL: The URL of the Kong admin API. Defaults to http://127.0.0.1:8001.
  • KONG_ADMIN_SSL: Whether to use SSL validation for the Kong admin API. Defaults to true.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts