All Questions
15 questions
1
vote
2
answers
738
views
Asyncio send multiple thousand requests
I am trying to create a script that can send a lot of requests to a website in the range of 100000 to 1.000.000. I am trying to use asyncio and aiohttp to do so but somehow I can't figure how to do it....
1
vote
0
answers
125
views
Why do my sio.emit calls from SocketIO in Python take 7-10 Seconds to arrive?
I am on a Raspberry Pi. I want to read from Serial, parse the command and then immediately send an update to a client connected via SocketIO.
In my understanding, Serial needs a while true - loop, so ...
3
votes
1
answer
835
views
Why does my process list show multiple threads when running aiohttp?
I'm currently using aiohttp in one of my projects which uses asyncio. After searching for reasons why I'm getting a high amount of memory usage I detected that aiohttp seem to create threads in the ...
0
votes
1
answer
2k
views
Asyncio HTTP requests without blocking main thread
I have a main thread which always needs to be available to read keyboard keypress input.
On each keypress I have to run 4 functions such as displaying, saving to a file, and making an HTTP request etc....
5
votes
2
answers
3k
views
One aiohttp ClientSession per thread?
In the documentation for aiohttp.ClientSession I have read that you should, ideally, create one ClientSession per application. I suspect that that should read something like "create one ...
5
votes
1
answer
5k
views
Flask asyncio aiohttp - RuntimeError: There is no current event loop in thread 'Thread-2'
Lately been reading about python concurrency realpython - python concurrency
My main focus asyncio so am fairly new.
The code block that performs asynchronous activities using asyncio and aiohttp runs ...
0
votes
1
answer
551
views
Asyncio requests using multithreading
I have a large list of companies and am calling a REST API to get daily stock price for each company. Details are stored in a PostgreSQL database. The core function looks as follows:
async def ...
1
vote
0
answers
337
views
Using aiohttp to fetch a page in a thread - got Future <Future pending> attached to a different loop
I want to use aiohttp to fetch pages in a thread, but when I executed, an error occurs.
I guess it may cause by aiohttp, the console show that the coro-task was destroyed but it is pending!
Hope to ...
5
votes
2
answers
5k
views
asyncio: why isn't it non-blocking by default
By default, asyncio runs coroutines synchronously. If they contain blocking IO code, they still wait for it to return. A way around this is loop.run_in_executor(), which converts the code into threads....
7
votes
3
answers
5k
views
How to merge async generators into a vanilla generator in python 3.5+
I'm having trouble combining async generators and actually running them. This is because the only way I 've found to run them is through an event loop which returns an iterable and not a generator. ...
2
votes
1
answer
617
views
How run many aiohttp servers from python program
How can i run many aiohttp servers from 1 python program
Example:
manager = Manager()
server1 = manager.create_server(config1)
server2 = manager.create_server(config2)
server1.run() # here ...
20
votes
1
answer
15k
views
Does Python asyncio use a thread pool?
I wrote this bit of code:
import asyncio
import threading
from aiohttp import ClientSession
async def fetch(url):
async with ClientSession() as session:
async with session.get(url) as ...
14
votes
1
answer
5k
views
Aiohttp ClientSession outside coroutine
I have a REST API wrapper which is supposed to run in an interactive Python session. HTTP requests are made both through an automated background thread (which uses the API wrapper) and manually by the ...
5
votes
1
answer
2k
views
improving speed of "Sending 100,000 request" by asyncio using multi-process and multi-thread
First of all, I want to send multiple-request using 1 connection as fast as possible. The code below work fine and fast but I want it to go beyond asynchronous. Back to my question, is it possible to ...
86
votes
4
answers
117k
views
How to combine python asyncio with threads?
I have successfully built a RESTful microservice with Python asyncio and aiohttp that listens to a POST event to collect realtime events from various feeders.
It then builds an in-memory structure to ...