>>> import twitter
>>> twitter_search = twitter.Twitter(domain="search.twitter.com")
>>> trends = twitter_search.trends()
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
trends = twitter_search.trends()
File "build\bdist.win32\egg\twitter\api.py", line 173, in __call__
return self._handle_response(req, uri, arg_data)
File "build\bdist.win32\egg\twitter\api.py", line 198, in _handle_response
raise TwitterHTTPError(e, uri, self.format, arg_data)
TwitterHTTPError: Twitter sent status 404 for URL: trends.json using parameters: ()
details: ‹
我也通过更改域来尝试
>>> import twitter
>>> twitter_api=twitter.Twitter(domain="api.twitter.com", api_version='1')
>>> WORLD_WOE_ID = 1
>>> world_trends = twitter_api.trends._(WORLD_WOE_ID)
>>> [ trend for trend in world_trends()[0]['trends'] ]
[{u'url': u'http://twitter.com/search/?q=%2320CutestFollowers', u'query': u'%2320CutestFollowers', u'events': None, u'promoted_content': None, u'name': u'#20CutestFollowers'}, {u'url': u'http://twitter.com/search/?q=%23watkiestnl', u'query': u'%23watkiestnl', u'events': None, u'promoted_content': None, u'name': u'#watkiestnl'}, {u'url': u'http://twitter.com/search/?q=%23FelizCumplea%C3%B1osAmaia', u'query': u'%23FelizCumplea%C3%B1osAmaia', u'name': u'#FelizCumplea\xf1osAmaia', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search/?q=%22Hi%20Boyfriend%22', u'query': u'%22Hi%20Boyfriend%22', u'events': None, u'promoted_content': None, u'name': u'Hi Boyfriend'}, {u'url': u'http://twitter.com/search/?q=%22Christina%20Legendtina%20Aguilera%22', u'query': u'%22Christina%20Legendtina%20Aguilera%22', u'events': None, u'promoted_content': None, u'name': u'Christina Legendtina Aguilera'}, {u'url': u'http://twitter.com/search/?q=%22Jeroen%20Pauw%22', u'query': u'%22Jeroen%20Pauw%22', u'events': None, u'promoted_content': None, u'name': u'Jeroen Pauw'}, {u'url': u'http://twitter.com/search/?q=%22Denmark%20Has%20%C3%86bleskiver%20Niall%22', u'query': u'%22Denmark%20Has%20%C3%86bleskiver%20Niall%22', u'name': u'Denmark Has \xc6bleskiver Niall', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search/?q=Jide', u'query': u'Jide', u'events': None, u'promoted_content': None, u'name': u'Jide'}, {u'url': u'http://twitter.com/search/?q=T.O', u'query': u'T.O', u'events': None, u'promoted_content': None, u'name': u'T.O'}, {u'url': u'http://twitter.com/search/?q=Getafe', u'query': u'Getafe', u'events': None, u'promoted_content': None, u'name': u'Getafe'}]
我得到了结果,但我无法理解。我是研究工作的新手,也是 python 和 twitterApi 的新手。