File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-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 ):
5
4
if token == None :
6
5
token = 'None'
6
+ else :
7
+ if ':' in token :
8
+ # token = authtoken:username:password
9
+ account = token .split (':' )[1 ] + ':' + token .split (':' )[- 1 ]
10
+ token = token .split (':' )[0 ]
11
+
7
12
config = conf .PyngrokConfig (
8
13
auth_token = token , region = region
9
14
)
10
15
try :
11
- public_url = ngrok .connect (port , pyngrok_config = config ).public_url
16
+ if account :
17
+ public_url = ngrok .connect (port , pyngrok_config = config , auth = account ).public_url
18
+ else :
19
+ public_url = ngrok .connect (port , pyngrok_config = config ).public_url
12
20
except exception .PyngrokNgrokError :
13
21
print (f'Invalid ngrok authtoken, ngrok connection aborted.\n '
14
22
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