show traceback msg while exception

This commit is contained in:
zhangjiexian 2023-03-20 23:45:49 +08:00
parent 317ccc9bf3
commit 1c8b51a7b7
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,8 @@ from . import consts as c, utils, exceptions
import time import time
import traceback
class Client(object): class Client(object):
def __init__(self, api_key = '-1', api_secret_key = '-1', passphrase = '-1', use_server_time=False, flag='1', base_api = 'https://www.okx.com',debug = False): def __init__(self, api_key = '-1', api_secret_key = '-1', passphrase = '-1', use_server_time=False, flag='1', base_api = 'https://www.okx.com',debug = False):
@ -49,7 +51,9 @@ class Client(object):
try: try:
response = self._request(method, request_path, params) response = self._request(method, request_path, params)
break break
except: except Exception as e:
msg = traceback.format_exc()
print(msg)
retry_times += 1 retry_times += 1
if retry_times > retry_times_max: if retry_times > retry_times_max:
print('reach max retry times, exit loop.') print('reach max retry times, exit loop.')