Tyk API Gateway and API Management Login 24/7 Support Community

Python

Requirements

Since v2.9, Tyk supports any currently stable Python 3.x version. The main requirement is to have the Python shared libraries installed, these are available as libpython3.x in most Linux distributions.

These instructions assume you’re running a current Ubuntu LTS version.

Install the build tools: apt-get install -y build-essential

Install the Required Modules

apt install python3 python3-dev python3-pip
pip3 install protobuf grpcio

How to write Python Plugins?

We have created a demo Python plugin repository.

The project implements a simple middleware for header injection, using a Pre hook (see Tyk custom middleware hooks. A single Python script contains the code for it, see middleware.py.