0

so when using aiohttp to send multiple requests to a single url (the ratelimit is 50 per sec) I'm getting ClientOSErros ('broken pipe') is there a way to avoid this?

async def send_req(data):
   async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(limit=50), headers=...) as s:
      async with s.put('...') as r:
         if r. status == 200:
            print('sent data successfully')
         elif r. status == 429:
            print('rate limited')




async def main():
   async with tasksio.TaskPool(5_000) as pool:
      for data in data_lists:
         await pool.put(send_req(data))
aiohttp.client_expceptions.ClientOSError
('broken pipe')```
Cashy
  • 11
  • 1

0 Answers0