ngrok
#
Description#
Plugin to dynamically create and manage network tunnels using ngrok.
Configuration#
ngrok:
# [Optional]
# Specify the ``ngrok`` auth token, enabling authenticated features (e.g. more concurrent
# tunnels, custom subdomains, etc.).
# auth_token: # type=Optional[str]
# [Optional]
# By default ``pyngrok`` manages its own version of the ``ngrok`` binary, but you can specify
# this option if you want to use a different binary installed on the system.
# ngrok_bin: # type=Optional[str]
# [Optional]
# ISO code of the region/country that should host the ``ngrok`` tunnel (default: ``us``).
# region: # type=Optional[str]
Dependencies#
pip
pip install pyngrok
Triggered events#
Actions#
Module reference#
- class platypush.plugins.ngrok.NgrokPlugin(auth_token: str | None = None, ngrok_bin: str | None = None, region: str | None = None, **kwargs)[source]#
Bases:
Plugin
Plugin to dynamically create and manage network tunnels using ngrok.
- __init__(auth_token: str | None = None, ngrok_bin: str | None = None, region: str | None = None, **kwargs)[source]#
- Parameters:
auth_token – Specify the
ngrok
auth token, enabling authenticated features (e.g. more concurrent tunnels, custom subdomains, etc.).ngrok_bin – By default
pyngrok
manages its own version of thengrok
binary, but you can specify this option if you want to use a different binary installed on the system.region – ISO code of the region/country that should host the
ngrok
tunnel (default:us
).
- close_tunnel(tunnel: str)[source]#
Close an
ngrok
tunnel.- Parameters:
tunnel – Name or public URL of the tunnel to be closed.
- create_tunnel(resource: int | str = 80, protocol: str = 'tcp', name: str | None = None, auth: str | None = None, **kwargs) dict [source]#
Create an
ngrok
tunnel to the specified localhost port/protocol.- Parameters:
resource –
This can be any of the following:
A TCP or UDP port exposed on localhost.
A local network address (or
address:port
) to expose.The absolute path (starting with
file://
) to a local folder - in such case, the specified directory will be served over HTTP through anngrok
endpoint (see https://ngrok.com/docs#http-file-urls).
Default: localhost port 80.
protocol – Network protocol (default:
tcp
).name – Optional tunnel name.
auth – HTTP basic authentication credentials associated with the tunnel, in the format of
username:password
.kwargs – Extra arguments supported by the
ngrok
tunnel, such ashostname
,subdomain
orremote_addr
- see the ngrok documentation for a full list.
- Returns:
{ "name": "tcp-8080-my-tunnel", "protocol": "tcp", "url": "tcp://8.tcp.ngrok.io:12345" }