diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2022-10-11 21:50:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 21:50:19 +0300 |
commit | 419e539fe33e5bd1f7c7f55b477f955f6bdfc822 (patch) | |
tree | 131ea9501cefd29b7e5cb4b3e1ea36d76c64beb6 /modules/ngrok.py | |
parent | 2536ecbb1790da2af0d61b6a26f38732cba665cd (diff) | |
parent | d7474a5185df2af84a93a12bc7e140d24e0fc516 (diff) |
Merge branch 'learning_rate-scheduling' into learnschedule
Diffstat (limited to 'modules/ngrok.py')
-rw-r--r-- | modules/ngrok.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/ngrok.py b/modules/ngrok.py new file mode 100644 index 00000000..7d03a6df --- /dev/null +++ b/modules/ngrok.py @@ -0,0 +1,15 @@ +from pyngrok import ngrok, conf, exception + + +def connect(token, port): + if token == None: + token = 'None' + conf.get_default().auth_token = token + try: + public_url = ngrok.connect(port).public_url + except exception.PyngrokNgrokError: + print(f'Invalid ngrok authtoken, ngrok connection aborted.\n' + f'Your token: {token}, get the right one on https://dashboard.ngrok.com/get-started/your-authtoken') + else: + print(f'ngrok connected to localhost:{port}! URL: {public_url}\n' + 'You can use this link after the launch is complete.') |