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

Limit HTTP POST upload bandwith

In my application, I'm uploading continuously videoclips, worth of tens of megabytes of video to a server in the cloud. The uploading part has been written in python aiohttp, while the receiving part in the cloud uses node.js and the "request"…
El Sampsa
  • 1,673
  • 3
  • 17
  • 33
0
votes
1 answer

how set query handler in aiohttp

i have next code: from aiohttp import web PORT = 8080 HOST = 'localhost' routes = web.RouteTableDef() @routes.get('/do_something?from={f}&to={s}') async def test_get(request): return web.json_response({request.match_info['f']:…
0
votes
1 answer

Create db connections before run aiohttp loop

is it not mistake create some connections (to DB, AMQP etc) before run web.run_app in aiohttp. Some example: async def init_app(): app = web.Application() app['db'] = await create_db_connection() app['amqp'] = await…
Mike
  • 860
  • 14
  • 24
0
votes
0 answers

Replicating "--connect-to" from curl in Python

From the command line, I am able to successfully execute a command as follows: curl --cacert --cert --connect-to ::1.2.3.4: https://some-identity.com:443/endpoint I am doing this so the request ends up going to the 1.2.3.4 address…
stoneman_41
  • 370
  • 2
  • 12
0
votes
1 answer

Why can't I connect with a proxy?

I wrote a small script for checking proxies: async def proxy_check(session, proxy): global good_proxies proxy_str = f'http://{proxy}' async with semaphore: try: async with session.get(host, proxy=proxy_str,…
kshnkvn
  • 876
  • 2
  • 18
  • 31
0
votes
0 answers

how to send the websocket message outside the corouture request

I stablish the coroutine WebSocket link, but only can send a message inside this coroutine, my question is how to send a message outside this coroutine with current client #!/usr/bin/env python3 import os,asyncio , threading,dotenv, aiohttp…
Hamid s k
  • 138
  • 2
  • 6
0
votes
1 answer

Aiohttp : Is any way to detect whether username is wrong or password is wrong in aiohttp?

I want different message for wrong password and wrong username?? How to detect from response whether wrong username or wrong password?? auth = aiohttp.BasicAuth(username, password) with aiohttp.ClientSession(loop=loop, auth=auth) as…
0
votes
1 answer

How can I check the difference between a Postman request and a Python http request?

I've been pulling my hair out the past couple of days trying to get a Python http request to work. I can get it working using Postman, but for some reason it just won't work no matter what I do in Python. I'm hoping if I can compare some raw version…
Matt Takao
  • 2,406
  • 3
  • 16
  • 30
0
votes
1 answer

HTTP server kick-off background python script without blocking

I'd like to be able to trigger a long-running python script via a web request, in bare-bones fashion. Also, I'd like to be able to trigger other copies of the script with different parameters while initial copies are still running. I've looked at…
T. Collins
  • 101
  • 1
  • 8
0
votes
0 answers

Async POST in Python 3.6+ in while loop

The scenario is the following. I'm capturing frames from a local webcam using OpenCV. I would like to POST every single frame in a while loop with the following logic: url = "http://www.to.service" while True: cap = cv2.VideoCapture(0) try: …
Fabrizio Miano
  • 493
  • 3
  • 11
0
votes
1 answer

How to return aiohttp like python requests?

I wanna return response list request.get or post But, I can't... First, I tryied return response but it returned coroutine object.... Here is my code import aiohttp from aiohttp import ClientSession as AioClientSession class MultiSession(object): …
lee
  • 53
  • 1
  • 2
  • 5
0
votes
1 answer

Canceling coroutines/tasks in proxychecker without waiting for completion

I have created a proxychecker that operates fine when it is left alone to check all the proxies. But I would like to implement functionality so that upon keyboard interrupt it cancels all pending proxychecking coroutines and exits gracefully. In its…
0
votes
0 answers

how to bind cPanel WGSI to an seperated aiohttp server

Hey guys I've just been trying to deploy my aiohttp+socketIo application into cPanel host which Supports python, and I've figured out cPanel uses a pre-build WSGI server itself, it routes all URLs to the function that you choose in the python app…
0
votes
0 answers

Error handling in asyncronous downloading routine

I need to download around 200 files from 200 urls in a very short time and very frequently. After countless attempts i came up with the code which is capable of downloading all files in a few seconds. Now i need to make sure that every file will get…
Th3Fi3nD
  • 67
  • 6
0
votes
1 answer

python 3.6 aiohttp is slow

I have a python web application to return some data from a DB. But when I have 100 concurrent users, it gets much slower. First, I thought it's the DB issue. But everything works fine on the DB. So I removed all the DB related code. It's just an…
rickcoup
  • 275
  • 1
  • 5
  • 20