通过代理连接发送带有标头的 aiohttp post 请求

png*_*iko 4 python proxy python-3.x aiohttp

我现在拥有的(Python 3.4):

r = yield from aiohttp.request('post', URL, params=None, data=values, headers=headers)
Run Code Online (Sandbox Code Playgroud)

文档内容:

conn = aiohttp.ProxyConnector(proxy="http://some.proxy.com")
r = await aiohttp.get('http://python.org', connector=conn)
Run Code Online (Sandbox Code Playgroud)

那么,我应该如何通过 aiohttp 的代理连接发送带有标头的 post 请求?

谢谢。

And*_*lov 5

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()
Run Code Online (Sandbox Code Playgroud)