0

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.

alexdlaird
  • 1,174
  • 12
  • 34
Kongu B K Riot
  • 117
  • 1
  • 6
  • There are multiple questions here in the same question. Try dividing up these into seperate questions so that people know which one to answer. – coderman1234 Mar 13 '21 at 15:51

1 Answers1

2

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.

alexdlaird
  • 1,174
  • 12
  • 34