【问题标题】:TypeError: GetHomeTimeline() got multiple values for keyword argument 'count'TypeError:GetHomeTimeline() 为关键字参数“count”获取了多个值
【发布时间】:2013-08-04 19:37:15
【问题描述】:
import simplejson
import httplib2
import twitter

api = twitter.Api(consumer_key='consumer key', consumer_secret='consumer secret', access_token_key='access token', access_token_secret='token secret')

timeline = api.GetHomeTimeline('@username', count=20, since_id=None, max_id=None, trim_user=False, exclude_replies=False, contributor_details=False, include_entities=True)

print [s.text for s in statuses]

【问题讨论】:

  • 请分享该错误的完整回溯。
  • 原谅我,但我是编码新手,需要回答我收到的错误“TypeError: GetHomeTimeline() got multiple values for keyword argument 'count'” 我正在尝试使用 Twitter -工具库来检索我的时间线
  • 是的,为了让我们更好地帮助您,我希望您为该异常添加完整的回溯。
  • 如何找到完整的回溯?
  • 查看库源代码我已经弄清楚了 API 的期望。

标签: python python-2.7 twitter


【解决方案1】:

GetHomeTimeline() 方法不需要用户名;它为当前经过身份验证的用户返回推文。去掉第一个参数:

timeline = api.GetHomeTimeline(count=20, since_id=None, max_id=None, trim_user=False, exclude_replies=False, contributor_details=False, include_entities=True)

print [s.text for s in timeline]

【讨论】:

  • 你仍然得到一个状态对象列表;遵循文档和示例。
猜你喜欢
  • 2016-06-24
  • 2015-05-18
  • 1970-01-01
  • 2013-03-09
  • 2016-04-25
  • 2012-11-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多