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

时间:2016-02-01 13:46:41

标签: python python-3.x proxy aiohttp

我现在拥有(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的代理连接发送带有标题的帖子请求?

感谢。

2 个答案:

答案 0 :(得分:3)

java.properties

答案 1 :(得分:1)

你可以用这个:

import aiohttp

conn = aiohttp.ProxyConnector(proxy="http://some.proxy.com")

r = await aiohttp.post('http://python.org', connector=conn, data=b"hello", headers={})

import aiohttp

from aiohttp import request

conn = aiohttp.ProxyConnector(proxy="http://some.proxy.com")

r = await request('post','http://python.org', connector=conn, data=b"hello", headers={})