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

asyncio/aiohttp not returning response

I am trying to scrape some data from https://www.officialcharts.com/ by parallelising web requests using asyncio/aiohttp. I implemented the code given at the link here. I followed two different procedures. The first one goes like this. from bs4…
Vinay
  • 1,149
  • 3
  • 16
  • 28
0
votes
1 answer

How to pass different parameter for each asynchronous method call in Python3 with aoihttp?

I have to make lots of post requests with varying parameters to an API. I currently for the parameter-dictionary using a loop and then run the request for each single one, which is very time consuming. I stumbled upon the aiohttp asynchronous…
0
votes
0 answers

python aiohttp: cancel handler if user re-requests

I have a very simple aiohttp web server: from aiohttp import web import time async def hello(request): time.sleep(2) # heavy calculations goes here return web.Response(text="Hello, world") app =…
XPlatformer
  • 1,148
  • 8
  • 18
0
votes
1 answer

Handling ensure_future and its missing tasks

I have a streaming application that almost continuously takes the data given as input and sends an HTTP request using that value and does something with the returned value. Obviously to speed things up I've used asyncio and aiohttp libraries in…
Augmented Jacob
  • 1,567
  • 19
  • 45
0
votes
1 answer

python crawler problems when using aiohttp

I'm a beginner in web spider and i am so confused these days when using aiohttp. Here is my code: header = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1', …
0
votes
1 answer

Asyncio and aiohttp returning task instead of results

I have a script to run parallel requests against an API within a class. However, the results I'm getting is basically a task instead of the actual results. Any reason why? I mimicked the modified Client code on…
srazzak
  • 3
  • 3
0
votes
1 answer

aiohttp: exception=TimeoutError()

I have test.py and AsyncioCurl.py files. I run python .\Src\test.pt and give me this error. PS C:\Users\Thinkpad\Desktop\BilibiliHelper> python .\Src\test.py 2019-02-22 10:28:27,696 - C:\Users\Thinkpad\Desktop\BilibiliHelper\Src\Log.py[line:56] -…
user10733862
0
votes
0 answers

HTTP post request in Python

I started to work with aiohttp. In order to make an HTTP POST request, after the following code was successful: async with aiohttp.ClientSession() as session: async with session.get('http://httpbin.org/get') as resp: print(resp.status) …
Tim
  • 11
  • 3
0
votes
1 answer

aiohttp upload file as curl -F

I have a request with curl -F "file=/tmp/test.txt" that responses 200, but I cant emulate this request in Python. I tried something like this mp = aiohttp.MultipartWriter() mp.append(open('/tmp/test.txt', 'rb')) result = await session.post(url,…
sanyassh
  • 8,100
  • 13
  • 36
  • 70
0
votes
1 answer

Event loop in asyncio is overflowing. Though adding 4 executions at a time it is overloading

In the following code I am calling getSUEPEvent() funtion 4 time for single loop. I restart loop again for next 4. Still execution keeps on adding to loop. If loop is global than can any one suggest another strategy to can funtion n number of time…
Ankush K
  • 334
  • 3
  • 13
0
votes
1 answer

Tornado doesnt yield futures correctly

I need to asynchronously make several http calls inside a tornado request handler. trying to return futures is not documented well and pretty much impossible to do on a gathered asyncio.gather at the handler level of tornado. I have tried aiohttp…
Erik K
  • 471
  • 5
  • 12
0
votes
0 answers

Exception Type: AttributeError at /notifier/not/ Exception Value: 'AsgiRequest' object has no attribute 'loop'

when i tried to run a piece if code in my django application i have been faced with some strange error def main(request): async def hello(request): ws = web.WebSocketResponse() await ws.prepare(request) msg="this is…
john
  • 539
  • 2
  • 9
  • 24
0
votes
1 answer

aiohttp: multiple requests to same URL return authentication error, but the URL is correct

I am using the below code to make 599 asynchronous requests to Strava API. For some reason the response I get for each of them is {"message":"Authorization Error","errors":[{"resource":"Application","field":"","code":"invalid"}]} This is the…
barciewicz
  • 3,511
  • 6
  • 32
  • 72
0
votes
1 answer

Can someone help to explain why the python aiohttp return more response content than requests.get?

Recently, I'm looking at the python aiohttp lib, play around it, compare with python requests. Here is the code: import aiohttp import asyncio import requests request_url = 'http://www.baidu.com' requests_resp = requests.get(request_url) async def…
Tide
  • 3
  • 5
0
votes
1 answer

Python response with excel file

I'm using api_hour for API web server and trying to response to request with excel file. But it is much more difficult than I thought. If I use nodejs or django, it is fine and there are many guide for it. But api_hour is not. The following code is…
wallah
  • 1,964
  • 5
  • 27
  • 48
1 2 3
99
100