I am having an issue with python 3.8.5 vs 3.7
given method:
import asyncio
import functools
_executor = ThreadPoolExecutor()
async def request_async(*args, **kwargs) -> requests.Response:
loop = asyncio.get_event_loop()
response = await loop.run_in_executor(_executor, functools.partial(requests.request, *args, **kwargs))
return response
and a call:
response = await request_async(protocol, url, headers=headers, *args, **kwargs)
^^ works in python 3.7 and returns a Response as per signature although in python 3.8 returns a Future in order to get to work needs to be awaited second time.
response = await (await request_async(protocol, url, headers=headers, *args, **kwargs))
I would appreciate some insights where to look and why it would happen.