Skip to main content
Version: 0.9.x

Python Interceptor

Installation

To begin the installation process, execute the following command:

pip3 install 'lunar-interceptor==0.3.*'

Configuration

The only required configuration is the LUNAR_PROXY_HOST environment variable. This variable should be set to the host or IP of Lunar Proxy, including the port it is listening on.

For example:

export LUNAR_PROXY_HOST="localhost:8000"
note

This environment variable sets the host and port for Lunar Proxy. Set this to localhost:8000 if you're running Lunar Proxy in a local Docker container.

For more details and other configuration options, refer to our Configuration Guide

Usage

Import Lunar Interceptor into the application entry point at the beginning of the file.

import lunar_interceptor
# imports ...

# your code
def main():

Run Your App and Validate Proxy/Interceptor Linkage

Run your app and consume API traffic. Then, use the Discover command to validate that the requests were passed through Lunar Proxy, and that your installed interceptor is correctly listed.

kubectl exec <lunar-proxy-pod-name> -- discover
Click me for guidance 😀