Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm experimenting with these two different libraries to submit a series of POST requests to routes on the same domain (i.e. domain/routeA, domain/routeB, domain/routeC, etc.). The problem is that when I use aiohttp.ClientSession, it seems to fetch the response from the first POST request but then receive incomplete response after that. However, when I use requests.session, I get all the responses properly. I'm not sure if there's any particular difference in these session types that's causing this or whatnot. I've verified that I'm passing the proper payload (I pass it as data=payload for both, so I think that the issue is not something that has to do with like having to set type to json / files / etc. There are no headers passed for both cases. The following is how I'm setting up each session

import aiohttp

tcp_connector = aiohttp.TCPConnector(limit=None, limit_per_host=0, ssl=False)
session = aiohttp.ClientSession(connector=tcp_connector)

resp = await session.post(...) # in async event loop, not sure if the event loop has an effect
import requests

session = requests.session

session.post(...)

If anyone knows what could be causing the issue, I'd really appreciate some help here. Thanks in advance!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.3k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...