Skip to main content

All Questions

0 votes
0 answers
105 views

Python request get Invalid param error when using data from websocket result

token_info_list = [] list_lock = threading.Lock() async def subscribe(): global token_info_list async with websockets.connect(pump_new_pair_url) as ws: # Subscribing to token creation ...
Luke Li's user avatar
  • 15
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'...
anarchy's user avatar
  • 5,214
0 votes
0 answers
398 views

How to create a progress bar with aiometer's run_all method?

I've been creating a pipeline from an API using httpx, asyncio and aiometer to limit the number of coroutines running at once. I know that it's possible to create a async progress bar for asyncio's ...
Fábio Marane's user avatar
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 ...
anarchy's user avatar
  • 5,214
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 ...
anarchy's user avatar
  • 5,214
-1 votes
1 answer
249 views

How to go through a list of API keys and repeat for each different request in url list?

import asyncio import aiohttp from time import perf_counter import csv path = "*******************" domains = [] total_count=0 with open(path, 'r') as file: csvreader = csv.reader(file)...
Dominic Jay's user avatar
0 votes
1 answer
549 views

count successful and unsuccessful post requests for asynchronous post call/request

I need help in implementing the logic to count number of successful post calls which are asynchronous in nature (status_code=200) as well as failed_calls (status_code != 200) I am new to coroutines. ...
harsh solanki's user avatar
3 votes
1 answer
1k views

How to pass body into aiohttp get request?

How do I pass a body into aiohttp's get requests? The code I have below is what I want to run asynchronously but im not able to get the same response - using requests request_accounts = requests.get(...
wwwwwwww's user avatar
1 vote
1 answer
1k views

How to avoid "too many requests" error with aiohttp

Here's a snippet of my parser code. It does 120 requests asynchronously. However, every response returns 429 "too many requests" error. How do I make it "slower", so the api won't ...
Dushamishkin's user avatar
1 vote
0 answers
984 views

Difference between requests module and aiohttp/httpx module from Asyncio perspective

My question is what exactly makes requests module incompatible and httpx, aiohttp modules compatible with Asyncio framework behind the scene? I'm familiar with Asynchronous concepts and how it works ...
S.B's user avatar
  • 16.6k
2 votes
0 answers
781 views

How to paginate a request asyncronously in python?

I am trying to extract the data from a response, which contains a cursor token that when passed as a parameter to the request url, returns the next 100 results. The cursor token is a hash value. I ...
Nate's user avatar
  • 167
1 vote
1 answer
568 views

Asynchronous http requests takes the same time as the synchronous one

i'm trying to scrape a website using aiohttp and asyncio in python, but it takes the same amount of time doing it in the synchronous way. This is the asynchronous code that i'm using: base_url="...
lasagn's user avatar
  • 11
0 votes
2 answers
2k views

Saving gzip file from Async HTTP request with Python

I'm trying to save a bunch of gzip files from an API response in async. Basically, I'm getting an array with different URI's and I have to append these to a base URL in order to download the .gz file. ...
Niels's user avatar
  • 31
1 vote
2 answers
3k views

How to run coroutine function when use sync_to_async in django?

I have add_event method that calls _post method as async using sync_to_async in django. but when I test the method inside of Django shell, it does not even run my async _post function and returns ...
Ali Soltani's user avatar
0 votes
2 answers
1k views

TypeError: '_SessionRequestContextManager' object is not iterable

From this tutorial for multiple asynchronous get requests I copied and ran the following code: import asyncio import aiohttp def fetch_page(url, idx): url = 'https://yahoo.com' response = ...
Qwertford's user avatar
  • 1,209

15 30 50 per page