This documentation explains how to develop this project.
make setup
Installation dependenciesexport PYTHONPATH=$PYTHONPATH:/path/to/apisix-python-plugin-runner
loading project pathAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock python3 apisix/main.py start
to start it./path/to/apisix-python-plugin-runner/apisix/plugin
the .py
files in this directory autoload
/path/to/apisix-python-plugin-runner/apisix/plugin/say.py
from apisix.runner.plugin.base import Base from apisix.runner.http.request import Request from apisix.runner.http.response import Response class Say(Base): def __init__(self): super(Say, self).__init__(self.__class__.__name__) def filter(self, request: Request, response: Response): headers = request.headers headers["X-Resp-A6-Runner"] = "Python" response.body = "Hello, Python Runner of APISIX" response.headers = headers
Base
classfilter
functionfilter
function parameters can only contain Request
and Response
classes as parametersself.config
can get plug-in configuration informationRun make test
.
1 byte of type + 3 bytes of length + data