Last active
January 4, 2024 07:56
-
-
Save Mistobaan/f06a846870ea8a94d59c5a846e15e351 to your computer and use it in GitHub Desktop.
How to get current ngrok remote url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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