Skip to main content

The ngrok Agent SDK for Python

Project description

The ngrok Agent SDK for Python

PyPI Supported Versions MIT licensed Apache-2.0 licensed Continuous integration

Note: This is beta-quality software. Interfaces may change without warning.

ngrok is a globally distributed reverse proxy commonly used for quickly getting a public URL to a service running inside a private network, such as on your local laptop. The ngrok agent is usually deployed inside a private network and is used to communicate with the ngrok cloud service.

This is the ngrok agent in library form, suitable for integrating directly into Python applications. This allows you to quickly build ngrok into your application with no separate process to manage.

If you're looking for the previous agent downloader project, it's over here.

Installation

The published library is available on PyPI.

python -m pip install ngrok

ngrok-py officially supports Python 3.7+.

Documentation

A quickstart guide and a full API reference are included in the ngrok-py Python API documentation.

Quickstart

After you've installed the package, you'll need an Auth Token. Retrieve one on the Auth Token page of your ngrok dashboard

There are multiple examples in the /examples directory. A minimal use-case looks like the following:

async def create_tunnel():
  builder = NgrokSessionBuilder()
  session = await builder.authtoken_from_env().connect()
  tunnel = await session.http_endpoint().metadata("python tun meta").listen()
  print("tunnel: {}".format(tunnel.url()))

  res = await tunnel.forward_tcp("localhost:9000")

Platform Support

Pre-built binaries are provided on PyPI for the following platforms:

OS i686 x64 aarch64 arm
Windows *
MacOS
Linux
Linux musl
FreeBSD *

ngrok-py, and ngrok-rs which it depends on, are open source, so it may be possible to build them for other platforms.

  • Windows-aarch64 will be supported after the next release of Ring.
  • FreeBSD-x64 is built by the release process, but PyPI won't accept BSD flavors.

Dependencies

This project relies on PyO3, an excellent system to ease development and building of Rust plugins for Python.

Thank you to OpenIoTHub for handing over the ngrok name on PyPI.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tokio-core by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

ngrok-0.4.0-cp37-abi3-win_amd64.whl (2.3 MB view hashes)

Uploaded CPython 3.7+ Windows x86-64

ngrok-0.4.0-cp37-abi3-win32.whl (2.0 MB view hashes)

Uploaded CPython 3.7+ Windows x86

ngrok-0.4.0-cp37-abi3-musllinux_1_2_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.7+ musllinux: musl 1.2+ x86-64

ngrok-0.4.0-cp37-abi3-musllinux_1_2_aarch64.whl (2.2 MB view hashes)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

ngrok-0.4.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ x86-64

ngrok-0.4.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.9 MB view hashes)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

ngrok-0.4.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view hashes)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

ngrok-0.4.0-cp37-abi3-macosx_11_0_arm64.whl (1.9 MB view hashes)

Uploaded CPython 3.7+ macOS 11.0+ ARM64

ngrok-0.4.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (4.0 MB view hashes)

Uploaded CPython 3.7+ macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

ngrok-0.4.0-cp37-abi3-macosx_10_7_x86_64.whl (2.1 MB view hashes)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page