File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
1
from pyngrok import ngrok , conf , exception
2
2
3
-
4
3
def connect (token , port , region ):
4
+ account = None
5
5
if token == None :
6
6
token = 'None'
7
+ else :
8
+ if ':' in token :
9
+ # token = authtoken:username:password
10
+ account = token .split (':' )[1 ] + ':' + token .split (':' )[- 1 ]
11
+ token = token .split (':' )[0 ]
12
+
7
13
config = conf .PyngrokConfig (
8
14
auth_token = token , region = region
9
15
)
10
16
try :
11
- public_url = ngrok .connect (port , pyngrok_config = config ).public_url
17
+ if account == None :
18
+ public_url = ngrok .connect (port , pyngrok_config = config ).public_url
19
+ else :
20
+ public_url = ngrok .connect (port , pyngrok_config = config , auth = account ).public_url
12
21
except exception .PyngrokNgrokError :
13
22
print (f'Invalid ngrok authtoken, ngrok connection aborted.\n '
14
23
f'Your token: { token } , get the right one on https://dashboard.ngrok.com/get-started/your-authtoken' )
You can’t perform that action at this time.
0 commit comments