What I have now (Python 3.4):
r = yield from aiohttp.request('post', URL, params=None, data=values, headers=headers)
What is in the documentation:
conn = aiohttp.ProxyConnector(proxy="http://some.proxy.com")
r = await aiohttp.get('http://python.org', connector=conn)
So, how should I send a post request with headers through proxy connection with aiohttp?
Thanks.
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()
you can use this:
import aiohttp
conn = aiohttp.ProxyConnector(proxy="http://some.proxy.com")
r = await aiohttp.post('http://python.org', connector=conn, data=b"hello", headers={})
or
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={})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With