Skip to content

Instantly share code, notes, and snippets.

@maxfire2008
Created October 23, 2021 00:35
Show Gist options
  • Save maxfire2008/1ffbfa83702098f0a2b2b494447e7e1f to your computer and use it in GitHub Desktop.
Save maxfire2008/1ffbfa83702098f0a2b2b494447e7e1f to your computer and use it in GitHub Desktop.
ngrok get url
# Prints ngrok.io tunnel name and port for miencarft to stdout
import os
import requests
os.system("pgrep -x ngrok > /dev/null && echo > /dev/null || ngrok tcp 25565 > /dev/null &")
print(json.loads(requests.get("http://127.0.0.1:4040/api/tunnels").content)["tunnels"][0]["public_url"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment