urlopen error「Errno 10061」解决(附python 获取状态码)
urllib2.URLError: <urlopen error [Errno 10061] > 解决
10061 因为目标主机主动拒绝,连接不能建立。
意料之外的坑
IE浏览器中 工具 -> Internet选项 ->连接 ->局域网设置 ->取消代理服务器复选框
python 获取状态码
urllib2.urlopen(request).code
- 1
或者
request = urllib2.Request(url, None, req_header)
try:
code = urllib2.urlopen(request).code
print("URL:" + url + " Statu:" + str(code))
except urllib2.HTTPError, e:
print("URL:" + url + " Status :" + str(e.code))
相关推荐
哥哥的CSDN集 2020-01-08
KilluaZoldyck 2020-01-06
IsanaYashiro 2019-12-12
kidneybeans 2010-08-18
Pipcie 2010-12-04
mojianbin 2011-06-16
zjuwangleicn 2017-12-01
insularisland 2019-09-08
zzpdljd 2012-06-03
eastnow 2015-03-24
chengwei0 2012-09-13
Astray 2012-02-07
旭灿 2010-12-30
comeonxueRong 2010-05-07
resilient 2019-06-28
MySQLLelove 2019-06-25