1

我正在尝试获取 Twitter 用户的最新状态。我输入以下内容:

>>> from twitter import *
>>> t = Twitter(auth=OAuth(...))
>>> t.statuses.friends_timeline(id="StephenAtHome")

我在最后一行收到以下错误:

Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    t.statuses.friends_timeline(id="StephenAtHome")
  File "twitter\api.py", line 204, in __call__
    return self._handle_response(req, uri, arg_data, _timeout)
  File "twitter\api.py", line 235, in _handle_response
    raise TwitterHTTPError(e, uri, self.format, arg_data)
TwitterHTTPError: Twitter sent status 404 for URL: 1.1/statuses/friends_timeline/StephenAtHome.json using parameters (oauth_consumer_key=i1xQ3YKmmUI9pKlYDmSPeA&oauth_nonce=12051576929978547960&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1371245218&oauth_token=1517563807-75iFGXWHxMvzzsqrIs5W4tCb4OwFG4eisnDYRst&oauth_version=1.0&oauth_signature=m0LDp%2FdkJLMr3sHPnFQkLKlDTrE%3D)
details: {"errors":[{"message":"Sorry, that page does not exist","code":34}]}

我该如何解决这个错误。我知道该页面存在

4

1 回答 1

1

问题是 twitter API 已升级到 1.1 版本并friends_timeline已被弃用(请参阅docs)。改用home_timelineuser_timeline应该有效但无效):

t.statuses.home_timeline(user_id="gvanrossum")

希望有帮助。

于 2013-06-14T21:49:19.140 回答