以编程方式通过Python代理发出HTTP请求

问题描述:

如何使用Python通过代理发出HTTP请求?

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')


urlopen 函数支持代理。试试这样的事情:

The urlopen function supports proxies. Try something like this:

urllib.urlopen(your_url, proxies = {"http" : "http://192.168.0.1:80"})