All Questions
133 questions
1
vote
1
answer
78
views
How to "swallow" python's asyncio library's TimeoutError exception
I have a python script that connects to a server and downloads a large amount of videos and photos. And when I say large, I mean in the tens of thousands. The total amount of data to be downloaded ...
0
votes
1
answer
59
views
asyncio server does not cancels request even if aiohttp.ClientSession exceeds its timeout
The final goal is to cancel request on server side if client exceeds its timeout.
The code related to start the server:
def run_server_loop(
routes: web.RouteTableDef,
shutdown_state: ...
1
vote
1
answer
94
views
Asyncio Proxy Checking
I am writing a script to determine working proxy servers. Everything runs smoothly with the Synchronous class, however, when I want to do this with asynchronous programming, I get very different ...
0
votes
1
answer
71
views
Why are my async requests almost as slow as sync requests
My code sends async requests to an API but it's not really faster than my code with sync requests. Currently it sends around 50-60 requests and it takes around 1 minute. What am I doing wrong?
#gets ...
1
vote
1
answer
341
views
Event loop is closed Python Async
I've built an email script , utilising a user's app key from google to get access to their email. However when i run the script i get the error 'Runtime Error: event loop is closed.
On initial ...
0
votes
1
answer
152
views
Asyncio lock not working when fetching data from API asynchronously
My function below is not working as intended. It is an async function, and I want it so that when the response is a 401 and the lock is not locked, it removes the first value in api_keys. When the ...
0
votes
0
answers
94
views
How can I pass a parameter to Async function in Python
So I am using Python Flask (ik, not optimal, but it is what I know.) However, I am getting an error that I understand, but I am not familiar enough with async to be able to solve it myself. I lack ...
-2
votes
1
answer
2k
views
RuntimeError: asyncio.run() cannot be called from a running event loop, a very simple program
import asyncio
import aiohttp
async def fetch_data(url):
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
data = await response.text()
...
0
votes
0
answers
437
views
Python AIOHTTP gets slow after a number of requests
I am using aiohttp library in Python to make async requests. I use the following code:
async def get_response(session, url):
async with session.get(url) as resp:
response_json = await resp....
0
votes
1
answer
242
views
Adding a timeout to an asyncio aiohttp
I am currently using the following code to query an api for data
import asyncio
async def get_data(session, ticker):
while True:
try:
async with session.get(url=f'api.exec.com'...
1
vote
2
answers
971
views
Multiple large requests using aiohttp
I need to send a large number (approximately 50) of HTTP POST requests, each with a size of around 5 MB. I use the asyncio.gather function to wait for the responses from these requests. However, the ...
0
votes
0
answers
109
views
aiohttp: infinite streaming with long wait periods
I am trying to connect to a REST API which will stream data infinitely when events are happening. In the meantime no data is sent through the API.
I have the following code:
async with self....
1
vote
1
answer
262
views
asyncio.Queue - put urls from txt file
I need to pass URLs from txt file to the script that fetch URLs and do some work with the help of aiohttp and asyncio. So I use asyncio.Queue to put URLs from txt file into queue. The nuance is that ...
0
votes
2
answers
613
views
How to add a try until success loop inside aiohttp requests
I have the following code,
import aiohttp
import asyncio
async def get_data(session, x):
try:
async with session.get(url=f'https://api.abc.com/{x}') as response:
data = await ...
0
votes
1
answer
329
views
Unable to get multiple response requests on aiohttp
I am trying to pull multiple responses requests using aiohttp but I am getting an attribute error.
My code looks like this, I had to obscure it because I am using a private api.
import aiohttp
import ...