4,356
社区成员
发帖
与我相关
我的任务
分享
# coding=utf-8
import urllib
#使用代理服务器的方法一
proxies = {'http':'http://111.12.13.170:55336/'}
opener = urllib.FancyURLopener(proxies)
f = opener.open("http://www.sina.com.cn/")
print f.read()
错误提示如下:
IOError: [Errno socket error] [Errno 10054]
定位到socket.py 480行
#使用代理服务器的方法二
proxies = {'http':'http://111.12.13.170:55336/'}
url = 'http://www.sina.com.cn/'
response = urllib.urlopen(url, proxies=proxies)
print response.info()
print response.getcode()
print response.geturl()