想从twitter上爬取数据时,出错URLError:
想从twitter上爬取数据时,报错URLError: <urlopen error [Errno 10060] >
错误的提示:
Traceback (most recent call last):
File "C:\Users\wangyaqi\Desktop\twitters.py", line 22, in <module>
tweets = api[apiIndex].GetSearch('@',(longitude,latitude,radius),None,None,None,100)
File "build\bdist.win-amd64\egg\twitter.py", line 2523, in GetSearch
json = self._FetchUrl(url, parameters=parameters)
File "build\bdist.win-amd64\egg\twitter.py", line 4535, in _FetchUrl
response = opener.open(url, encoded_post_data)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 404, in open
response = self._open(req, data)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 422, in _open
'_open', req)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 382, in _call_chain
result = func(*args)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 1184, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 10060] >
墙已经翻过去,好像是代码中没授权的原因?
------解决方案--------------------
你要用一个系统全局代理才可以,因为连接是python.exe进行的,它本身没有proxy选项
错误的提示:
Traceback (most recent call last):
File "C:\Users\wangyaqi\Desktop\twitters.py", line 22, in <module>
tweets = api[apiIndex].GetSearch('@',(longitude,latitude,radius),None,None,None,100)
File "build\bdist.win-amd64\egg\twitter.py", line 2523, in GetSearch
json = self._FetchUrl(url, parameters=parameters)
File "build\bdist.win-amd64\egg\twitter.py", line 4535, in _FetchUrl
response = opener.open(url, encoded_post_data)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 404, in open
response = self._open(req, data)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 422, in _open
'_open', req)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 382, in _call_chain
result = func(*args)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "G:\StudyingSoft\Python2.7\lib\urllib2.py", line 1184, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 10060] >
墙已经翻过去,好像是代码中没授权的原因?
------解决方案--------------------
你要用一个系统全局代理才可以,因为连接是python.exe进行的,它本身没有proxy选项