How to access wallet variables like USDT balance?

when accessing commands like request_client.get_balance() Is there a way to access the data that is being printed to the shell?

For example, If I call the command request_client.get_balance() I get:

 [{"accountAlias":"XYZ","asset":"USDT","balance":"16.97222205"}]

but If I print it like so,

result = request_client.get_balance()
print(result)

I get:

[<binance_f.model.balance.Balance object at XXX>, <binance_f.model.balance.Balance object at XXX>, <binance_f.model.balance.Balance object at XXX>]

I would like to be able to access the data itself and use it as a variable, is there any way to do so?

Thank you!

You should be able to access data from the get_balance() method by iterating through each Balance object within the result array.

To access the balance variable from the example you provided, the following snippet should be sufficient

balance = result[0].balance
1 Like

Oh wow it works!! thank you so much I was looking all over the place to access this