Python Forum
send requests to URL with proxy - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: send requests to URL with proxy (/thread-4294.html)



send requests to URL with proxy - jpmo02 - Aug-06-2017

Hello
I want to send a POST/GET request to an URL
I use from Requests module and create a Session
and send my requests with this session

Please help me to send this request with a Proxy (proxy is annonymouse and without user/pass)

I Test these three way but can't get answer (Of course maybe I made a mistake!)
Way 1:
session.proxies = {pr: ip + ":" + port}
Way 2:
proxy = {pr: ip + ":" + port}
s = session.post(link, data, proxies=proxy, headers=head)
Way 3:
req = requests.Request('POST', link, data=data, headers=head)
prepped = req.prepare()
resp = session.send(prepped, proxies=proxy)
Please help me or say to me a different way
Thanks a lot


RE: send requests to URL with proxy - metulburr - Aug-07-2017

that is the only way i know of
http://docs.python-requests.org/en/master/user/advanced/#proxies