tags:

views:

464

answers:

2

How do I use Python to make an HTTP request through a proxy?

What do I need to do to the following code?

urllib.urlopen('http://www.google.com')
+3  A: 

The urlopen function supports proxies. Try something like this:

urllib.urlopen(your_url, proxies = {"http" : "http://192.168.0.1:80"})
Andrew Hare
How would I use a proxy from http://www.primeproxies.com/ with this method?
hekevintran
Well, since those sites are not proxy servers you would require a very different solution. Technically a proxy server is a machine on your network that relays all internet traffic.
Andrew Hare
+1  A: 

You could look at PycURL. I use cURL a lot in PHP and i love it. Though there is probably a neat way to do this currently in Python.

Ólafur Waage