Top "Python-asyncio" questions

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

Writing files asynchronously

I've been trying to create a server-process that receives an input file path and an output path from client processes …

asynchronous python-3.5 python-asyncio python-aiofiles
How to create an event loop with rolling coroutines running on it forever?

In order to prevent from context switching, I want to create a big loop to serve both the network connections …

python python-3.x asynchronous coroutine python-asyncio
Mocking async call in python 3.5

How do I mock async call from one native coroutine to other one using unittest.mock.patch? I currently have …

python python-asyncio python-mock
How to test Python 3.4 asyncio code?

What's the best way to write unit tests for code using the Python 3.4 asyncio library? Assume I want to test …

python unit-testing python-3.x python-unittest python-asyncio
Can an asyncio event loop run in the background without suspending the Python interpreter?

The documentation for asyncio gives two examples for how to print "Hello World" every two seconds: https://docs.python.org/3/…

python concurrency python-asyncio
Proper way to shutdown asyncio tasks

I am writing a tool which connects to X number of UNIX sockets, sends a command and saves the output …

python python-asyncio
Simplest async/await example possible in Python

I've read many examples, blog posts, questions/answers about asyncio / async / await in Python 3.5+, many were complex, the simplest I …

python python-3.x asynchronous async-await python-asyncio
"async with" in Python 3.4

The Getting Started docs for aiohttp give the following client example: import asyncio import aiohttp async def fetch_page(session, …

python python-3.x async-await python-asyncio aiohttp
asyncio.run() cannot be called from a running event loop

I would like to use asyncio to get webpage html. I run the following code in jupyter notebook: import aiofiles …

python python-3.x jupyter-notebook python-asyncio
How I call an async function without await?

I have a controller action in aiohttp application. async def handler_message(request): try: content = await request.json() perform_message(…

python python-asyncio aiohttp