How to use the jsonrpcclient.aiohttp_client.aiohttpClient function in jsonrpcclient

To help you get started, we’ve selected a few jsonrpcclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github QuarkChain / pyquarkchain / quarkchain / loadtest / tx_generator.py View on Github external
async def __sendRequest(self, *args):
        client = aiohttpClient(self.session, self.url)
        response = await client.request(*args)
        return response
github QuarkChain / pyquarkchain / quarkchain / testnet / fund_game_addresses.py View on Github external
async def __send_request(self, *args):
        client = aiohttpClient(self.session, self.url)
        response = await client.request(*args)
        return response
github QuarkChain / pyquarkchain / quarkchain / tools / fund_testnet.py View on Github external
async def __send_request(self, *args):
        client = aiohttpClient(self.session, self.url)
        # manual retry since the library has hard-coded timeouts
        while True:
            try:
                response = await client.request(*args)
                break
            except Exception as e:
                print("{} !timeout! retrying {}".format(self.url, e))
                await asyncio.sleep(1 + random.randint(0, 5))
        return response
github QuarkChain / pyquarkchain / quarkchain / tools / batch_deploy_contract.py View on Github external
async def __send_request(self, *args):
        client = aiohttpClient(self.session, self.url)
        response = await client.request(*args)
        return response
github icon-project / loopchain / loopchain / baseservice / rest_client.py View on Github external
async def _call_async_jsonrpc(self, target: str, method: RestMethod, params: Optional[NamedTuple], timeout):
        # 'aioHttpClient' does not support 'timeout'
        url = self._create_jsonrpc_url(target, method)
        async with ClientSession() as session:
            http_client = aiohttpClient(session, url)
            request = self._create_jsonrpc_params(method, params)
            return await http_client.send(request)
github trinity-project / trinity / gateway / network / jsonrpc.py View on Github external
async def jsonrpc_request(method, params, addr):
        async with ClientSession() as session:
            endpoint = 'http://' + addr[0] + ":" + str(addr[1])
            client = aiohttpClient(session, endpoint)
            rpc_logger.info("--> send msg to wallet_cli{}".format(addr))
            response = await client.request(method, params)
            from gateway import gateway_singleton
            gateway_singleton.handle_wallet_response(method, response)
github trinity-project / trinity / gateway / discarded / jsonrpc.py View on Github external
async def jsonrpc_request(loop, method, params):
        async with ClientSession(loop=loop) as session:
            endpoint = 'http://' + cg_remote_jsonrpc_addr[0] + ":" + str(cg_remote_jsonrpc_addr[1])
            # endpoint = 'http://106.15.91.150:20556'
            client = aiohttpClient(session, endpoint)
            start_time = time.time()
            response = await client.request(method, params)
            ttl = time.time() - start_time
            print("++++++++gateway<----->wallet spend time{}+++++++++".format(ttl))
            from gateway import gateway_singleton
            gateway_singleton.handle_jsonrpc_response(method, response)