Skip to main content

Download & Install

The fastest way to put anything on the internet.

PythonSDK

1

Get started with Python

Clone the ngrok Python SDK example and install dependencies:

git clone git@github.com:ngrok/python-sdk-example.git && cd python-sdk-example
pip install -r requirements.txt
2

Run your app

NGROK_AUTHTOKEN=<YOUR_AUTHTOKEN> python main.py

Don’t have an authtoken? for a free account.

Open your ngrok URL in a browser to see it working!

You’re all set. What’s next?

1tp = """2on_http_request:3  # redirect users to Google to log in4  - actions:5    - type: oauth6      config:7        provider: google8 9  # allow logins *only* from acme.com10  - expressions:11    - "!actions.ngrok.oauth.identity.email.endsWith('@acme.com')"12    actions:13    - type: deny14"""15 16forwarder = ngrok.forward("localhost:8085", authtoken_from_env=True, traffic_policy=tp)

Inspect every detail of your traffic

Watch the flow in real time, then dig into the headers, body, latency, response, and more for every request.

Peruse the Python SDK quickstart

Follow along to embed ngrok into your app and use Traffic Policy for auth and traffic transformation.

Bring your own domain

Paid feature

Create a DNS CNAME record to use your own domain name for your endpoint URL.

1forwarder = ngrok.forward(2  "localhost:8085",3  authtoken_from_env=True,4  domain="app.acme.com",5)

Add load balancing

Endpoint Pooling lets you automatically distribute traffic among any number of replicas of your app.

1forwarder = ngrok.forward(2  "localhost:8085",3  authtoken_from_env=True,4  pooling_enabled=True,5)