diff options
author | DepFA <35278260+dfaker@users.noreply.github.com> | 2022-10-11 15:15:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 15:15:09 +0100 |
commit | 1eaad955330bbe2d55f6b528c902758739413dc8 (patch) | |
tree | fba92d854e283d3a413b1b36682bb23171a086d7 /modules/ngrok.py | |
parent | 7aa8fcac1e45c3ad9c6a40df0e44a346afcd5032 (diff) | |
parent | e0ee5bf703996b33e6d97aa36e0973ceedc88503 (diff) |
Merge branch 'master' into embed-embeddings-in-images
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.') |