Reputation: 117
How would I write a Python program that automates ngrok
connections? I've tried using pyngrok
, but I want to display an https
URL and it always returns http
.
Upvotes: 0
Views: 5239
Reputation: 995
For those who are using pyngrok version 4.1, passing the argument bind_tls= True
directly will raise an error. Try using:
options = {
"bind_tls": True
}
public_url = ngrok.connect(port='80',options=options)
That will work.
Upvotes: 0
Reputation: 1293
Per the pyngrok
docs, two tunnels are opened by default, one http
, one https
. Just use bind_tls=True
if you only want the https
tunnel and it will be returned.
from pyngrok import ngrok
https_tunnel = ngrok.connect(bind_tls=True)
If you want to know how pyngrok
does this, its code is open source.
Upvotes: 2