The ngrok Python SDK is an official, open-source library that enables developers to integrate secure ingress directly into their Python applications. It acts as a Python-packaged version of the ngrok Agent CLI, allowing applications to expose local services to the internet without complex network configurations. The library is actively maintained, with a current version of 1.7.0, and typically sees updates in line with major ngrok platform developments.
pip install ngrokVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to expose a local service (assumed to be running on port 9000) to the internet using `ngrok.forward()`. It requires an ngrok authtoken, ideally set as an environment variable `NGROK_AUTHTOKEN`. The `while True: time.sleep(1)` loop keeps the tunnel active until a keyboard interrupt.
For direct application ingress, use `pip install ngrok` and `import ngrok`. For managing the ngrok binary, use `pip install pyngrok` and `import pyngrok`.
Sign up on ngrok.com to get an authtoken. Set it as an environment variable `NGROK_AUTHTOKEN` or pass it directly to `ngrok.forward(..., authtoken='YOUR_AUTHTOKEN')`.
If not using a blocking call or an integrated framework, explicitly call `ngrok.disconnect()` for specific tunnels and `ngrok.kill()` to shut down the ngrok process when it's no longer needed, especially in serverless or containerized environments.
Ensure that your ngrok agent is running and connected. If the issue persists, check the ngrok documentation for ERR_NGROK_3200 or contact support.
Verify that your local service is running and accessible at the specified address. Ensure that the correct port is being used in the ngrok command.
Run the installation or command with elevated privileges using 'sudo', or install ngrok in a directory where you have write permissions.
Ensure that your local service is running on the specified port and is accessible. Verify that the port number in the ngrok command matches the port your service is using.
Install the official ngrok Python SDK using pip: `pip install ngrok`
No dependency data recorded yet.