skillfed

pyngrok

A Python wrapper for ngrok

pyngrok v8.1.2 2.8M downloads/30d#2,872 on PyPI464
Permissive license MIT Active released

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 pyngrok

uv

uv add pyngrok

poetry

poetry add pyngrok

Installing 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

Development Status :: 6 - MatureEnvironment :: ConsoleEnvironment :: Web EnvironmentIntended Audience :: DevelopersOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: BSD :: FreeBSDOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Database :: Database Engines/ServersTopic :: Internet :: Proxy ServersTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Internet :: WWW/HTTP :: HTTP ServersTopic :: Software Development :: Build ToolsTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Testing

Tags

ngrok python wrapperreverse proxy tunnel localhostexpose local server publiclywebhook testing tunnelingsecure tunnel public urlngrok api pythonlocal development tunneling
tunnelingwebhook-testinglocal-development

More Python Modules packages