Top "Python-asyncio" questions

This tag is to be used for the asyncio Python package which provides mechanisms for writing single-threaded concurrent code.

aiohttp: set maximum number of requests per second

How can I set maximum number of requests per second (limit them) in client side using aiohttp?

python python-asyncio aiohttp
@asyncio.coroutine vs async def

With the asyncio library I've seen, @asyncio.coroutine def function(): ... and async def function(): ... used interchangeably. Is there any functional …

python python-3.x async-await python-3.5 python-asyncio
Python - Attempt to decode JSON with unexpected mimetype:

I recently swapped over from requests to aiohttp because I couldn't use it in asyncio loops. The swap went perfectly …

python json python-3.x python-asyncio aiohttp
How to use asyncio with existing blocking library?

I have few blocking functions foo, bar and I can't change those (Some internal library I don't control. Talks to …

python python-3.x async-await python-3.5 python-asyncio
What does the "yield from" syntax do in asyncio and how is it different from "await"

From the perspective of someone who has written asyncio code but is looking to better understand the inner workings, what …

python async-await generator python-asyncio coroutine
aiohttp: Serve single static file

How to serve a single static file (instead of an entire directory) using aiohttp? Static file serving seems to be …

http python-asyncio aiohttp
RuntimeError: Task attached to a different loop

Hi I'm using AsyncIOMotorClient for asynchronous db calls to mongoDb. Below is my code. xyz.py async def insertMany(self,…

mongodb python-asyncio tornado-motor
Python3 asyncio "Task was destroyed but it is pending" with some specific condition

Here is simplified code, which uses python3 coroutine and sets handler for SIGING and SIGTERM signals for stopping job properly: #!/…

python-3.x coroutine python-asyncio
Best way to insert multiple rows with asyncpg

I want to insert multiple rows and get IDs back with asyncpg, i found two ways: 1: generate sql like this …

python postgresql python-asyncio asyncpg
AttributeError: module 'asyncio' has no attribute 'create_task'

I'm trying to asyncio.create_task() but I'm dealing with this error: Here's an example: import asyncio import time async …

python python-3.x async-await python-3.6 python-asyncio