Questions tagged [aiohttp]

Use this tag for questions about AIOHTTP – a client/server framework for asyncio Python.

AIOHTTP is an asynchronous asyncio Python web framework for both client and server sides. It supports HTTP, WebSockets, and also MiddleWare and Signals mechanics for the server side.

Useful links:

Related tags:

1628 questions
0
votes
1 answer

Pass arguments to aiohttp class based view

Is there any simple way to pass custom arguments to View instances with aiohttp ? This works: import aiohttp.web import functools class Parent(): def __init__(self, val): self.var = val class BaseView(aiohttp.web.View): def…
NicoAdrian
  • 946
  • 1
  • 7
  • 18
0
votes
1 answer

How to write exception for ProxyConnetionError (errno - 10060, can't connect to proxy) for a Django project

Can anyone please help me how to write exception for a ProxyConnectionError? I have tried following code in Django project after browsing internet from aiohttp_socks import ProxyConnectionError try: return render(request,"data.html") except…
0
votes
1 answer

In python socketio RuntimeWarning: coroutine 'initial' was never awaited despite writing an await statement

python3 client.py /home/aijax/.local/lib/python3.6/site-packages/socketio/client.py:592: RuntimeWarning: coroutine 'initial' was never awaited self._handle_event(pkt.namespace, pkt.id, pkt.data) connection established despite of having the await…
aijax
  • 47
  • 10
0
votes
1 answer

aiohttp: Trying to connect to a site

I'm making a Discord Bot in Python to scrape Hack The Box data. This is already functional, but I want to use async with aiohttp for increase speed when I'm requesting each profile of each member. So in the synchronous version, I made a login…
0
votes
0 answers

Access full request info in aiohttp client response

I would like to logging proxy host and port information for each clinent request in aiohttp. aiohttp.ClientResponse class has a request_info property which contains very basic information about current request. My current code is: async with…
Plazik
  • 1
0
votes
1 answer

python, aiohttp, AssertionError: data argument must be byte-ish ()

I'm getting the error shown in the title. Here is the traceback: 2020-01-13T05:03:49.967604+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/aiohttp_debugtoolbar/middlewares.py", line 57, in…
Mike Johnson
  • 37
  • 1
  • 5
0
votes
0 answers

Python aiohttp.ClientPayloadError with Artifactory API

Having a strange issue while trying to use aiohttp/asyncio with Artifactory REST API. The strange thing is that the below code works perfectly for 'url_2' but permanently fails with aiohttp.client_exceptions.ClientPayloadError: Response payload is…
zumby
  • 69
  • 1
  • 4
0
votes
0 answers

Using Python's aiohttp to make a web request, I'm getting a browser out of date error?

I am trying to use the aynscio and aiohttp packages to request a web page. However, the web page response is:

Please upgrade your web browser.


This browser version is outdated, and may not be…

Alex F
  • 2,086
  • 4
  • 29
  • 67
0
votes
0 answers

Ensuring unique timestamps generation in asyncio/aiohttp coroutines

I'm rewriting a web scraper with aiohttp. At some point, it has to make a POST request with a payload notably including a 'CURRENT_TIMESTAMP_ID'. These requests seem to always succeed, but they sometimes are redirected (302 status code) to another…
Lo Bellin
  • 485
  • 4
  • 20
0
votes
1 answer

aiohttp - before request for each API call

When I was using Flask, every API call is authenticated before processed: app = connexion.App(__name__, specification_dir='./swagger/', swagger_json=True, swagger_ui=True, server='tornado') app.app.json_encoder =…
Anant
  • 153
  • 14
0
votes
1 answer

How can I process the values returned by a large number of coroutines on the fly (asyncio issue)?

I have a very huge list of urls that I'd like to scrape. At first, I was thinking of doing something like this: async def main(username, password): sem = asyncio.Semaphore(100) async with aiohttp.ClientSession() as session: await…
Lo Bellin
  • 485
  • 4
  • 20
0
votes
0 answers

Aiohttp concurrent responds get hung

All the requests are working normally but after 90% of the tasks the responds get hung and timeout. In the following code, if you change n_requests to 1000 or 10 the problem is still there and it seems always to be 10% which wont get a response. It…
user8198347
0
votes
1 answer

CORS headers in python3

i am trying to get into websockets for my project, thats why i started to learn about websockets. i found a page and already the first guided example brought me to this issue: i successfully create a server and want to connect to it via my browser,…
Maetran
  • 11
  • 2
0
votes
1 answer

Download file with resume capability using aiohttp and python

I want to stream and download file using aiohttp. Chrome can support the resume capability of download link But the download manager cannot download the file with the resume capability. In the code below I used aiohttp framework to stream and…
Amin
  • 23
  • 1
  • 9
0
votes
0 answers

run celery and aiohttp in the same service

my goal is to send live notifications to the user. the message will arrive from a celery worker. and will be sent to the user using aiohttp through sockjs. how can i run both on the same app ? or receive the messages on the aiohttp instance where i…
shay te
  • 1,028
  • 3
  • 12
  • 23