get_total_balance doesn't pass api_key down to get_address_overview
eddieparker opened this issue · comments
Excerpt:
def get_address_overview(address, coin_symbol='btc', api_key=None):
'''
Takes an address and coin_symbol and return the address details
'''
assert is_valid_address_for_coinsymbol(b58_address=address,
coin_symbol=coin_symbol)
url = make_url(coin_symbol, 'addrs', **{address: 'balance'})
params = {}
if api_key:
params['token'] = api_key
r = requests.get(url, params=params, verify=True, timeout=TIMEOUT_IN_SECONDS)
return get_valid_json(r)
def get_total_balance(address, coin_symbol='btc', api_key=None):
'''
Balance including confirmed and unconfirmed transactions for this address,
in satoshi.
'''
return get_address_overview(address=address, coin_symbol=coin_symbol)['final_balance']
This makes everyone rate limited as if they're accessing things without a token.
Hi @eddieparker could you clarify the issue?
your function get_total_balance takes an api_key parameter and doesn't use it. It would be great if it used it in the get_address_overview() so it can use your api_key.
More explicitly, your function looks like this:
def get_total_balance(address, coin_symbol='btc', api_key=None):
return get_address_overview(address=address, coin_symbol=coin_symbol)['final_balance'])
When it should look like this:
def get_total_balance(address, coin_symbol='btc', api_key=None):
return get_address_overview(address=address, coin_symbol=coin_symbol)['final_balance'], api_key=api_key)
Ah got it and it's basically everywhere... See #98 for a fix. Please review if you can.