https://github.com/ngrok/ngrok-api-python
ngrok API client library for Python
https://github.com/ngrok/ngrok-api-python
Last synced: 9 months ago
JSON representation
ngrok API client library for Python
- Host: GitHub
- URL: https://github.com/ngrok/ngrok-api-python
- Owner: ngrok
- License: mit
- Created: 2021-05-08T01:16:46.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-25T15:08:02.000Z (about 1 year ago)
- Last Synced: 2025-04-03T01:44:38.685Z (9 months ago)
- Language: Python
- Homepage:
- Size: 2.2 MB
- Stars: 29
- Watchers: 4
- Forks: 16
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ngrok API client library for Python
This library wraps the [ngrok HTTP API](https://ngrok.com/docs/api) to make it
easier to consume in Python.
## Installation
This library is published on [PyPi](https://pypi.org/project/ngrok-api/):
pip install ngrok-api
## Support
The best place to get support using this library is through the [ngrok Slack Community](https://ngrok.com/slack). If you find any bugs, please contribute by opening a new GitHub issue.
## Documentation
A quickstart guide and a full API reference are included in the [ngrok python API documentation](https://python-api.docs.ngrok.com).
## Quickstart
Please consult the [documentation](https://python-api.docs.ngrok.com) for additional examples.
import ngrok
# Construct the API client
client = ngrok.Client("")
# List all online tunnels
for t in client.tunnels.list():
print(t)
# Create an IP policy that allows traffic from some subnets
policy = client.ip_policies.create()
for cidr in ["24.0.0.0/8", "12.0.0.0/8"]:
client.ip_policy_rules.create(cidr=cidr, ip_policy_id=policy.id, action="allow")