我正在从 twitter API 1.1 获取数据。当我使用 GetFavorites 函数时出现以下错误:
In [16]: fav_list = api.GetFavorites(screen_name='cshikhardua')
---------------------------------------------------------------------------
TwitterError Traceback (most recent call last)
<ipython-input-16-f9bfd7deaf24> in <module>()
----> 1 fav_list = api.GetFavorites(screen_name='cshikhardua')
<ipython-input-2-2df6e498a699> in GetFavorites(self, user_id, screen_name, count, since_id, max_id, include_entities)
4241
4242 json = self._FetchUrl(url, parameters=parameters)
-> 4243 data = self._ParseAndCheckTwitter(json)
4244 return [Status.NewFromJsonDict(x) for x in data]
4245
<ipython-input-2-2df6e498a699> in _ParseAndCheckTwitter(self, json)
4917 try:
4918 data = simplejson.loads(json)
-> 4919 self._CheckForTwitterError(data)
4920 except ValueError:
4921 if "<title>Twitter / Over capacity</title>" in json:
<ipython-input-2-2df6e498a699> in _CheckForTwitterError(self, data)
4944 # to check first, rather than try and catch the exception
4945 if 'error' in data:
-> 4946 raise TwitterError(data['error'])
4947 if 'errors' in data:
4948 raise TwitterError(data['errors'])
TwitterError: Not authorized
但是,如果我使用具有相同屏幕名称和相同 Api 实例的 GetFollowers 函数,我会得到适当的响应:
In [18]: fav_list
Out[18]:
([<__main__.User at 0x2ffa450>,
<__main__.User at 0x2ffa850>,
<__main__.User at 0x2ffa750>],
0,
0)
谁能帮我理解出了什么问题?