Skip to content

Instantly share code, notes, and snippets.

@Mistobaan
Last active January 4, 2024 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mistobaan/f06a846870ea8a94d59c5a846e15e351 to your computer and use it in GitHub Desktop.
Save Mistobaan/f06a846870ea8a94d59c5a846e15e351 to your computer and use it in GitHub Desktop.
How to get current ngrok remote url
# from: https://stackoverflow.com/a/54088479/121687
import json
import requests
def get_ngrok_url():
url = "http://localhost:4040/api/tunnels/"
res = requests.get(url)
res_unicode = res.content.decode("utf-8")
res_json = json.loads(res_unicode)
for i in res_json["tunnels"]:
if i['name'] == 'command_line':
return i['public_url']
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment