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
0 answers

Collecting results of tasks gathered coroutines gathered in asyncio.gather()

I want to execute two tasks forever which are run in parallel by asyncio.gather(). The first task contains some logic, for which I want to wait in the while True: loop. The second task is asyncio.sleep() which is responsible for execution of my…
0
votes
1 answer

Even using asyncio and aiohttp, methods wait for the request response

Hi I have the following issue, I want to execute getlastItemFromGivenInterval method, let it briefly to go through without waiting for request reponses, and give a context to asyncio.sleep(60) to execute the whole procedure once more in 60 seconds…
0
votes
0 answers

how to post a dummy json response to the server without adding it to database using Django rest framework

im trying to figure out is there any way to create post json response to the server without adding it to database tried using APIView but that didnt work with my code async def index(request): async with aiohttp.ClientSession() as client: …
john
  • 539
  • 2
  • 9
  • 24
0
votes
0 answers

AIOHTTP: web.run_app(app,port=9090) ^ SyntaxError: invalid syntax

whenever i try to integrate templates in aiohttp im facing this issue i dont know where exactly the issue is from here is my code from aiohttp import web from routes import setup_routes import aiohttp_jinja2 import jinja2 app =…
john
  • 539
  • 2
  • 9
  • 24
0
votes
1 answer

python asyncio/aiohttp sharing globals across project

I have an asyncio project. It has several modules. Many of them need access to a few globals, like: 1. aiohttp ClientSession() object, since according to aiohttp docs, I should avoid creating a new ClientSession for every request. 2. asyncio socket,…
user3599803
  • 6,435
  • 17
  • 69
  • 130
0
votes
0 answers

Unable to mimick a Postman request in Python aiohttp

I am trying to get this Postman Collection request to run in aiohttp but unable to do so. It runs in Postman well and shows data. You can use this url to test it yourself. This is Python code I am trying to use. async def test2(): url =…
Chaks
  • 82
  • 2
  • 15
0
votes
1 answer

python async await can not return tuple

I want to create a function to download from a website asynchronously. I need the results of the download to be joined to input parameters so I can use both the results as well as the parameters after the download. I currently have the…
Yorian
  • 2,002
  • 5
  • 34
  • 60
0
votes
1 answer

await resp.prepare(request) AttributeError: 'NoneType' object has no attribute 'prepare'

async def index(request): async with aiohttp.ClientSession() as client: data=await(email_verification(client)) await client.post('http://127.0.0.1:8000/acc/signup',data=data) async def email_verification(client): async…
john
  • 539
  • 2
  • 9
  • 24
0
votes
1 answer

Multiple aiohttp sessions

Is there a way for each URL have its own session? I read the aiohttp docs found on Github but I couldn't find if this is possible. I know it's possible with requests but unsure how to do so with aiohttp. Any help is appreciated as I haven't been…
BrianHunt
  • 15
  • 1
  • 3
0
votes
1 answer

How to use curl (or similar software) with "docker run" if ENTRYPOINT already used?

I want to create docker image with Tor/aiohttp server to use as a proxy for HTTP requests (curl mostly). I've already prepared working Docker image (I can use external curl -x with it), the main problem with syntax. What I need: I need to use this…
sortas
  • 1,527
  • 3
  • 20
  • 29
0
votes
1 answer

aioodbc question mark in sql server error

I use aioodbc for connect to SQL Server for aiohttp. I was written 2 functions in python3: async with aioodbc.create_pool(dsn=dsn, loop=loop, autocommit=True) as pool: async with pool.acquire() as conn: async with conn.cursor() as cur: …
0
votes
0 answers

aiohttp redirect without return

I have a route function that executes an async function that takes a long time to return. Therefore when you go to that route, the page will not redirect for a long time: @routes.get('/test') async def test(request): …
Manu Masson
  • 1,667
  • 3
  • 18
  • 37
0
votes
2 answers

Read Http Stream

I am trying to read from a streaming API where the data is sent using Chunked Transfer Encoding. There can be more than one record per chunk, each record is separated by a CRLF. And the data is always sent using gzip compression. I am trying to get…
0
votes
1 answer

Time cost difference between opening a new thread to run requests and aiohttp.ClientSession for async IO?

I understood aiohttp supports the async IO so it's completely single thread. But run_in_executor sort of starts a new thread. But I tested for a task with 1000 downloads, it seems the difference is rather insignificant. But I assume aiohttp should…
bot1
  • 77
  • 2
  • 12
0
votes
0 answers

Creating non blocking restful service using aiohttp

Requirement : webservice to support initialization of training function of machine learning model and return success, which takes around 4 hours to complete. To support predict function on previously trained models. Both of above function should…
Sach
  • 904
  • 8
  • 20
1 2 3
99
100