python 通过代理 进行网络编程

以下代码是在网上搜的:

 1 #proxy就是代理:
 2 #如果你使用goagent的话,就是127.0.0.1:8087
 3 
 4 opener = urllib2.build_opener( urllib2.ProxyHandler({'http':proxy}) ) 
 5 
 6 urllib2.install_opener( opener ) 
 7 
 8 sContent = urllib2.urlopen('http://www.facebook.com').read() 
 9 
10 print sContent

 参考:

python实现twitter client

http://blog.csdn.net/readreply/article/details/5214854

Python抓站如何使用代理服务器

http://developer.51cto.com/art/201003/188558.htm

python使用urllib代理上网

http://www.codeif.com/topic/441

原文地址:https://www.cnblogs.com/hengli/p/2549274.html