def __get_balance(address, url): """ Get balance of the address indicated by address. :param address: icx account address starting with 'hx' :param url: :return: icx """ method = 'icx_getBalance' params = {'address': address} payload = create_jsonrpc_request_content(0, method, params) response = post(url, payload) content = response.json() hex_balance = content['result']['response'] dec_loop_balance = int(hex_balance, 16) return dec_loop_balance
def request_generator(url): while True: payload = yield yield post(url, payload)