aiohttp icon indicating copy to clipboard operation
aiohttp copied to clipboard

asyncio http call times out

Open rickcoup opened this issue 5 years ago • 6 comments

Long story short

We are making async call to the a site. It times out on it. With the network sniffer, it shows the site responses within 400ms.

Expected behaviour

Get the response back.

Actual behaviour

Throwing the error:

File "/opt/app-root/src/pppLib.py", line 407, in fetch\n async with session.post(url, data=pData, headers=head, timeout=timeout) as response:\n File "/opt/app-root/lib/python3.6/site-packages/aiohttp/client.py", line 1005, in aenter\n self._resp = await self._coro\n File "/opt/app-root/lib/python3.6/site-packages/aiohttp/client.py", line 575, in _request\n break\n File "/opt/app-root/lib/python3.6/site-packages/aiohttp/helpers.py", line 585, in exit\n raise asyncio.TimeoutError from None"}   I've checked the client.py code, haven't get much clue on it yet.

Steps to reproduce

The code is like this:

async def fetch(session, url):
    #async with session.get(url) as response:
    async with getattr(session,"get")(url) as response:
        return await response.text()

Your environment

redhat 3.9, python 3.6.3, aiohttp 3.5.4 and asyncio 3.4.3

rickcoup avatar Feb 26 '19 03:02 rickcoup