pyngrok 8.0.0


pip install pyngrok

  Latest version

Released: Apr 01, 2026


Meta
Author: Alex Laird
Maintainer: Alex Laird
Requires Python: >=3.9

Classifiers

Development Status
  • 6 - Mature

Environment
  • Console
  • Web Environment

Intended Audience
  • Developers

Operating System
  • MacOS
  • Microsoft :: Windows
  • OS Independent
  • POSIX
  • POSIX :: BSD :: FreeBSD
  • POSIX :: Linux
  • Unix

Programming Language
  • Python :: 3
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: Implementation :: CPython
  • Python :: Implementation :: PyPy

Topic
  • Database :: Database Engines/Servers
  • Internet :: Proxy Servers
  • Internet :: WWW/HTTP :: Dynamic Content
  • Internet :: WWW/HTTP :: HTTP Servers
  • Software Development :: Build Tools
  • Software Development :: Testing
  • Software Development :: Libraries :: Python Modules

pyngrok - a Python wrapper for ngrok

Version PyPI - Downloads Python Versions Coverage Build Code Quality Docs GitHub License

pyngrok is a Python wrapper for ngrok that manages its own binary, making ngrok available via a convenient Python API and the command line.

ngrok is a reverse proxy that opens secure tunnels from public URLs to localhost. It's perfect for rapid development (test webhooks, demo local websites, enable SSH access), establishing ingress to external networks and devices, building production APIs (traffic policies, OAuth, load balancing), and more. And it's made even more powerful with native Python integration through the pyngrok client.

Installation

pyngrok is available on PyPI and can be installed using pip:

pip install pyngrok

or conda:

conda install -c conda-forge pyngrok

That's it! pyngrok is now available as a package to your Python projects, and ngrok is now available from the command line.

Basic Usage

Open a Tunnel

To open a tunnel, use the connect method, which returns a NgrokTunnel, and this returned object has a reference to the public URL generated by ngrok in its public_url attribute.

from pyngrok import ngrok

# Open a HTTP tunnel on the default port 80
# <NgrokTunnel: "https://<public_sub>.ngrok.io" -> "http://localhost:80">
http_tunnel = ngrok.connect()

# Open a SSH tunnel
# <NgrokTunnel: "tcp://0.tcp.ngrok.io:12345" -> "localhost:22">
ssh_tunnel = ngrok.connect("22", "tcp")

# Open a named tunnel from the config file
named_tunnel = ngrok.connect(name="my-config-file-tunnel")

# Open an Internal Endpoint that's load balanced
# <NgrokTunnel: "https://some-endpoint.internal" -> "http://localhost:9000">
internal_endpoint = ngrok.connect(addr="9000",
                                  domain="some-endpoint.internal",
                                  pooling_enabled=True)

The connect method takes kwargs as well, which allows you to pass additional tunnel configurations that are supported by ngrok (or the name of a tunnel defined in ngrok's config file), as documented here.

ngrok's API

The api method allows you to use the local ngrok agent to make requests against the ngrok API, if you have set an API key. For example, here's how you would reserve a ngrok domain, then create a Cloud Endpoint with an associated traffic policy:

from pyngrok import ngrok

domain = "some-domain.ngrok.dev"
ngrok.api("reserved-domains", "create",
          "--domain", domain)
ngrok.api("endpoints", "create",
          "--bindings", "public",
          "--url", f"https://{domain}",
          "--traffic-policy-file", "policy.yml")

Command Line Usage

This package puts the default ngrok binary on your path, so all features of ngrok are available on the command line.

ngrok http 80

For details on how to fully leverage ngrok from the command line, see ngrok's official documentation.

Documentation

For more advanced usage, pyngrok's official documentation is available on Read the Docs.

Integration Examples

Contributing

If you would like to get involved, be sure to review the Contribution Guide.

Want to contribute financially? If you've found pyngrok useful, sponsorship would also be greatly appreciated!

8.0.0 Apr 01, 2026
7.5.1 Mar 06, 2026
7.5.0 Nov 17, 2025
7.4.1 Oct 23, 2025
7.4.0 Sep 23, 2025
7.3.0 Aug 04, 2025
7.2.12 Jul 09, 2025
7.2.11 Jun 05, 2025
7.2.10 Jun 05, 2025
7.2.9 May 28, 2025
7.2.8 May 09, 2025
7.2.7 May 05, 2025
7.2.6 May 05, 2025
7.2.5 Apr 23, 2025
7.2.4 Apr 14, 2025
7.2.3 Jan 08, 2025
7.2.2 Dec 13, 2024
7.2.1 Nov 04, 2024
7.2.0 Jul 18, 2024
7.1.6 Mar 24, 2024
7.1.5 Mar 08, 2024
7.1.4 Mar 05, 2024
7.1.3 Feb 26, 2024
7.1.2 Feb 11, 2024
7.1.1 Feb 09, 2024
7.1.0 Feb 02, 2024
7.0.5 Dec 30, 2023
7.0.4 Dec 28, 2023
7.0.3 Dec 04, 2023
7.0.2 Dec 01, 2023
7.0.1 Nov 14, 2023
7.0.0 Sep 20, 2023
6.1.2 Sep 19, 2023
6.1.1 Sep 19, 2023
6.1.0 Sep 13, 2023
6.0.0 Apr 12, 2023
5.2.3 Apr 12, 2023
5.2.2 Apr 11, 2023
5.2.1 Nov 29, 2022
5.2.0 Nov 28, 2022
5.1.0 Aug 25, 2021
5.0.6 Aug 08, 2021
5.0.5 Mar 26, 2021
5.0.4 Mar 08, 2021
5.0.3 Mar 03, 2021
5.0.2 Feb 12, 2021
5.0.1 Dec 28, 2020
5.0.0 Oct 25, 2020
4.2.2 Oct 12, 2020
4.2.1 Oct 11, 2020
4.1.16 Oct 12, 2020
4.1.15 Oct 11, 2020
4.1.13 Oct 03, 2020
4.1.12 Sep 10, 2020
4.1.11 Sep 09, 2020
4.1.10 Aug 14, 2020
4.1.9 Aug 12, 2020
4.1.8 Jul 27, 2020
4.1.7 Jul 24, 2020
4.1.6 Jul 09, 2020
4.1.5 Jul 06, 2020
4.1.4 Jul 06, 2020
4.1.3 Jun 21, 2020
4.1.2 Jun 19, 2020
4.1.1 Jun 18, 2020
4.1.0 Jun 18, 2020
4.0.3 Jun 17, 2020
4.0.2 Jun 17, 2020
4.0.1 Jun 09, 2020
4.0.0 Jun 09, 2020
3.1.1 Jun 06, 2020
3.1.0 Jun 04, 2020
3.0.0 May 29, 2020
2.1.7 May 06, 2020
2.1.6 May 04, 2020
2.1.5 May 02, 2020
2.1.4 Apr 24, 2020
2.1.3 Mar 28, 2020
2.1.2 Mar 23, 2020
2.1.1 Mar 22, 2020
2.1.0 Mar 22, 2020
2.0.3 Feb 14, 2020
2.0.2 Feb 08, 2020
2.0.1 Feb 02, 2020
2.0.0 Jan 28, 2020
1.4.4 Jan 28, 2020
1.4.3 Jan 13, 2020
1.4.2 Sep 09, 2019
1.4.0 Jun 25, 2019
1.3.8 Jun 23, 2019
1.3.7 Jun 01, 2019
1.3.6 May 30, 2019
1.3.5 May 29, 2019
1.3.4 May 26, 2019
1.3.3 May 07, 2019
1.3.2 Apr 29, 2019
1.3.1 Jan 21, 2019
1.3.0 Jan 20, 2019
1.2.2 Jan 18, 2019
1.2.0 Jan 18, 2019
1.1.2 Jan 04, 2019
1.1.1 Dec 20, 2018
1.0.0 Dec 18, 2018
0.3.2 Dec 18, 2018
0.3.1 Dec 17, 2018
0.3.0 Dec 17, 2018
0.2.2 Dec 17, 2018
0.2.1 Dec 17, 2018
0.2.0 Dec 17, 2018
0.1.2 Dec 17, 2018

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
PyYAML (>=5.1)