我现在拥有的(Python 3.4):
r = yield from aiohttp.request('post', URL, params=None, data=values, headers=headers)
documentation 里有什么:
conn = aiohttp.ProxyConnector(proxy="http://some.proxy.com")
r = await aiohttp.get('http://python.org', connector=conn)
那么,我应该如何通过 aiohttp 的代理连接发送带有 header 的 post 请求?
谢谢。
最佳答案
connector = aiohttp.ProxyConnector(proxy="http://some.proxy.com")
session = aiohttp.ClientSession(connector=connector)
async with session.post("http://example.com/post", data=b"binary data") as resp:
print(resp.status)
session.close()
关于python - 通过代理连接发送带有 header 的 aiohttp post 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35132127/