A minimal Python app demonstrating the ngrok Python SDK.
- An ngrok account.
- Your ngrok auth token.
- Python installed on your machine.
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.env
file from the example:cp .env.example .env
-
Add your ngrok auth token to the
.env
file:NGROK_AUTHTOKEN=your_actual_authtoken_here
-
Reserve a domain in the ngrok dashboard and add it to the
.env
file:NGROK_RESERVED_DOMAIN=your_actual_authtoken_here
-
Start the Python service:
python service.py
-
In another terminal, start the ngrok agent endpoint:
python endpoint.py
The ngrok agent endpoint will output a URL that forwards traffic to your local app.
service.py
- Basic Python HTTP serverendpoint.py
- ngrok agent endpoint configuration with OAuth.env.example
- Environment variable templaterequirements.txt
- Python dependencies