0
我從twitter API 1.1獲取數據。當我使用GetFavorites功能得到以下錯誤:twitter 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
但是,如果使用GetFollowers具有相同的屏幕名稱和API的同一個實例功能,我得到適當的響應:
In [18]: fav_list
Out[18]:
([<__main__.User at 0x2ffa450>,
<__main__.User at 0x2ffa850>,
<__main__.User at 0x2ffa750>],
0,
0)
誰能幫助我理解怎麼了?