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

Code "crashing" in await ClientResponse.text()

I'm trying to create an api, and when i try to convert the aiohttp.ClientResponse to text, my code never finishes (never go to the next line) and it raises TimeoutError, I tried to do this in terminal (with the same site), and it works, can someone…
user9259249
0
votes
1 answer

aiohttp websocket and redis pub/sub

i created a simple websocket server using aiohttp . my server reads message from redis pub/sub and sends it to client . this is my websocket code: import aiohttp from aiohttp import web import aioredis router =…
Shoobi
  • 88
  • 1
  • 10
0
votes
1 answer

How start aiohttp app in multiple workers?

I want aiohttp app running on number of processes. Tornado has server = HTTPServer(app) server.bind(8888) server.start(0) for starting workers (0 - cpu cores). I know about gunicorn. But i want server embeded into application. Found…
eri
  • 3,133
  • 1
  • 23
  • 35
0
votes
2 answers

How to redirect 404 into another template with aiohttp?

I would like to achieve this function: if there's no relevent results in route table(404) ,then redirect it to render a custom made 404 template. Is there's any way of implementation in aiohttp? thanks
AdamHommer
  • 657
  • 7
  • 22
0
votes
1 answer

Pipenv won't lock after package install with python 3.8 due to python version

I have python 3.6 and 3.8 on my machine. I initialize a pipenv with: pipenv --python 3.8 I do this otherwise by default it initializes with 3.6 This works well. However, whenever I try to install a package (my use case was with aiohttp) I get the…
rlou
  • 498
  • 4
  • 16
0
votes
1 answer

what's the order if there are two asyncio.get_event_loop?

There are two things need to be done: host website and send notification.So I use the following ways to solve this problems: from aiohttp import web import asyncio async def _send_proactive_message(): ... async def pre_init(): await…
andy
  • 1,951
  • 5
  • 16
  • 30
0
votes
1 answer

Asyncio requests using multithreading

I have a large list of companies and am calling a REST API to get daily stock price for each company. Details are stored in a PostgreSQL database. The core function looks as follows: async def get_data_asynchronous(): conn = await…
akd
  • 25
  • 1
  • 5
0
votes
1 answer

Get aiohttp request response in callback with a infinite loop of asyncio task

What I am doing- I am trying to make multiple post requests(to the same URL with different parameters) in an infinite loop using asyncio and aiohttp. def callback(response): print(response) async def make_request(session, payload, sema): …
Ahsan aslam
  • 1,149
  • 2
  • 16
  • 35
0
votes
0 answers

The requested address is not valid in its context error (Socketio Python Aiohttp)

I’m having trouble implementing SSL to my aiohttp TCPSite connection. I have a VPS set up with Ubuntu and Apache. My config files are set to enable CORS and SSL is active on the server. When I go to the actual resource ie…
MjBVala
  • 137
  • 3
  • 9
0
votes
1 answer

Problem while reading urls from csv file and getting the output in csv file as well

The below code is supposed to return the status code and model number of few products from the website https://www.selexion.be/. It was working fine when i put all the urls in urls array inside the code but when i am fetching url form csv file i am…
0
votes
0 answers

Swapping the NIC used by my aiohttp script in GCE?

I am trying to run a script that sends traffic from 2 or 3 IP addresses at the same time. I have set up the script on a GCE platform running Ubuntu. I am using aiohttp to asynchronously send a scalable X amount of requests to a specfic endpoint. …
GreenGodot
  • 6,030
  • 10
  • 37
  • 66
0
votes
2 answers

aiohttp with browser_cookie3

I'm trying to use 'aiohttp' with 'browser-cookie3' however it doesn't accept the cookiejar, it shows the following message: "cannot unpack non-iterable Cookie object" My cookie works with 'requests' but isn't working with aiohttp How should I modify…
0
votes
1 answer

API + grequests

I have a script that sends lots of numbers, almost 27k, to our server through API then I get some info. However, I would like to send a few requests at once, is it possible through grequests? Because I've seen some examples and its kinda grequests…
user12483582
0
votes
1 answer

AIOHTTP Server - Jinja templates for raise conditions

In creating a site with AIOHTTP Web, I might define a route and raise an error like: async def index(request): if some_error_happened: raise web.HTTPException(body=b'Some error happened.') context = {'page_title': "My Site"} …
Paragon512
  • 143
  • 8
0
votes
2 answers

Send asynchronous HTTP requests one after another

I am trying to use aiohttp to send requests one after another like this import aiohttp import asyncio from datetime import datetime async def main(): request_url = "https://..." async with aiohttp.ClientSession() as session: while…
Jack P
  • 469
  • 1
  • 6
  • 16