问题
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')
回答1:
The urlopen
function supports proxies. Try something like this:
urllib.urlopen(your_url, proxies = {"http" : "http://192.168.0.1:80"})
回答2:
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.
来源:https://stackoverflow.com/questions/894168/programmatically-make-http-requests-through-proxies-with-python