pyngrok
A Python wrapper for ngrok
What it is and what it does
pyngrok is a Python wrapper around ngrok, a reverse proxy that creates secure tunnels from public URLs to services running on localhost. It manages the ngrok binary automatically, so you don't need to download or configure it separately. You can use it either through a Python API (calling `ngrok.connect()` to open tunnels and get public URLs) or directly from the command line (the ngrok binary is placed on your PATH).
The package supports both ngrok v2 and v3 APIs, handles tunnel configuration through Python kwargs or ngrok config files, and provides access to ngrok's local agent API for advanced operations like reserving domains or creating cloud endpoints. It's designed for rapid development workflows—testing webhooks, demoing local websites, enabling SSH access—as well as production use cases like traffic policies and load balancing.
Use it for:
- Test webhook integrations locally by exposing your development server to external services without deploying.
- Demo a local web application to stakeholders or clients by sharing a public ngrok URL.
- Enable SSH or other protocol access to a machine behind a firewall or NAT.
- Set up end-to-end testing that requires external services to reach your test server.
- Create temporary public ingress to internal networks or devices for development or debugging.
- Build production APIs with traffic policies, OAuth, or load balancing using ngrok's cloud endpoints.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pyngrok wraps the ngrok reverse-proxy binary and exposes it through a Python API, allowing you to programmatically open secure tunnels from public URLs to localhost.
Yes. pyngrok is mature, actively maintained, has no known vulnerabilities, and installs with minimal friction. It solves a real problem—making ngrok accessible from Python without manual binary management—and is well-suited for both development and production use. The single dependency (PyYAML) is lightweight and widely trusted.
Install
pyngrok on PyPI
pip
pip install pyngrokuv
uv add pyngrokpoetry
poetry add pyngrokInstalling pyngrok
Before you install
Low friction: pure Python wheel with a single runtime dependency (PyYAML). The package is actively maintained with a recent release and no known vulnerabilities.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects.
Quickstart
pip install pyngrok
from pyngrok import ngrok
# Open a HTTP tunnel on the default port 80
http_tunnel = ngrok.connect()
print(http_tunnel.public_url)
The ngrok binary is downloaded and managed automatically on first use; internet connectivity is required for tunnel operation.
Verify before relying
- Whether the ngrok binary download happens at install time or at first tunnel creation.
- Storage location and size of the downloaded ngrok binary on disk.
- Whether PyYAML is used for ngrok config file parsing or for other internal purposes.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — PyYAML |
| Maintenance | actively maintained — 107 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,833,876/month — #2,872 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyngrok-8.1.2-py3-none-any.whl
Keywords: tunnel, webhook, reverse-proxy, ngrok, localhost, ingress, tunneling
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
flask-cloudflaredStarts a Cloudflare TryCloudflare tunnel for a…
permissive · top 15,000 on PyPI
ngrokExposes ngrok's secure gateway service to…
permissive · top 15,000 on PyPI
prime-tunnelExposes local services via secure tunnels on…
permissive · top 15,000 on PyPI
sshtunnelEstablishes SSH tunnels to forward local ports…
permissive · top 1,000 on PyPI
pproxypproxy is an asynchronous proxy server that…
permissive · top 15,000 on PyPI
proxy.pyA lightweight, pluggable HTTP proxy server…
permissive · top 5,000 on PyPI
sshuttlesshuttle creates a transparent proxy that…
copyleft · top 15,000 on PyPI
PySocksPySocks provides a SOCKS and HTTP proxy client…
permissive · top 1,000 on PyPI
mitmproxymitmproxy is an interactive, SSL/TLS-capable…
permissive · top 5,000 on PyPI
requests-ntlm2Adds NTLM authentication support to the…
permissive · top 15,000 on PyPI