Skip to content

Commit

Permalink
fixed total wallet balance request
Browse files Browse the repository at this point in the history
  • Loading branch information
Failton committed Aug 25, 2023
1 parent c4864e6 commit 049c9a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')

Expand Down
8 changes: 4 additions & 4 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 049c9a7

Please sign in to comment.