diff --git a/app/utils.py b/app/utils.py index bf0bc27..b48efe1 100644 --- a/app/utils.py +++ b/app/utils.py @@ -50,7 +50,7 @@ def send_request(node_process, session, method, url, payload={}, params={}): return resp elif (resp.status_code == 429): if ('used_chains' not in url): - sleep(random.randint(5, 6)) + sleep(random.randint(1, 5)) else: logger.error(f'Bad request status code: {resp.status_code} | Method: {method} | Response: {resp.text} | Url: {url} | Headers: {session.headers} | Payload: {payload}') diff --git a/start.py b/start.py index d735454..c4a22a7 100644 --- a/start.py +++ b/start.py @@ -81,18 +81,18 @@ def get_chains(node_process, session, wallets): def get_wallet_balance(node_process, session, address): payload = { - 'id': address, + 'user_addr': address, } - edit_session_headers(node_process, session, payload, 'GET', '/user') + edit_session_headers(node_process, session, payload, 'GET', '/asset/net_curve_24h') resp = send_request( node_process, session=session, method='GET', - url=f'https://api.debank.com/user?id={address}', + url=f'https://api.debank.com/asset/net_curve_24h?user_addr={address}', ) - usd_value = resp.json()['data']['user']['stats']['usd_value'] + usd_value = resp.json()['data']['usd_value_list'][-1][1] return usd_value