File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -33,19 +33,25 @@ def get_token(self):
3333 proxy = self .back_up_proxy ()
3434 self .set_proxy ()
3535
36- with ThreadPoolExecutor (max_workers = 1 ) as executor :
37- future = executor .submit (self .run_mitmproxy )
38- if not self .check_cert ():
39- if not self .install_cert ():
40- self .restore_proxy (proxy )
41- executor .shutdown (wait = False )
42- return False
43-
44- logger .info ("请打开久事体育APP小程序并登录" )
45- future .result ()
46- logger .info ("成功获取到 token, 可以退出小程序了" )
36+ try :
37+ with ThreadPoolExecutor (max_workers = 1 ) as executor :
38+ future = executor .submit (self .run_mitmproxy )
39+ if not self .check_cert ():
40+ if not self .install_cert ():
41+ self .restore_proxy (proxy )
42+ executor .shutdown (wait = False )
43+ return False
44+
45+ logger .info ("请打开久事体育APP小程序并登录" )
46+ future .result ()
47+ logger .info ("成功获取到 token, 可以退出小程序了" )
48+ return True
49+ except Exception as e :
50+ logger .info ("获取 token 过程中出现错误" )
51+ logger .debug (e , exc_info = True )
52+ return False
53+ finally :
4754 self .restore_proxy (proxy )
48- return True
4955
5056 def read_token (self ):
5157 config_path = self .assets_path / "config.json"
You can’t perform that action at this time.
0 commit comments