Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def __sendRequest(self, *args):
client = aiohttpClient(self.session, self.url)
response = await client.request(*args)
return response
async def __send_request(self, *args):
client = aiohttpClient(self.session, self.url)
response = await client.request(*args)
return response
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
async def __send_request(self, *args):
client = aiohttpClient(self.session, self.url)
response = await client.request(*args)
return response
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)
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)
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)