mirror of
https://github.com/ngrok/ngrok-api-python.git
synced 2026-05-17 16:50:36 +00:00
436d30f0cd299e2e039ed4751ecb29008a1badef
ngrok API client library
This library wraps the ngrok HTTP API to make it easier to consume in Python.
Installation
This library is published on PyPi
pip install ngrok-api
Documentation
A quickstart guide and a full API reference are included in the ngrok python API documentation
Quickstart
Please consult the documentation for additional examples.
import ngrok
# construct the api client
ng = ngrok.Client("<API KEY>")
# list all online tunnels
for t in ng.tunnels():
print(t)
# create an ip policy the allows traffic from some subnets
policy = ng.ip_policies.create(action="allow")
for cidr in ["24.0.0.0/8", "12.0.0.0/8"]:
ng.ip_policy_rules.create(cidr=cidr, ip_policy_id=policy.id)
Languages
Python
100%