【问题标题】:tweepy unbound method_call errortweepy unbound method_call 错误
【发布时间】:2012-08-26 13:24:39
【问题描述】:

我正在尝试使用 tweepy 进行简单请求,以获取有关特定用户屏幕名称的信息。我这样做了:

import tweepy
api = tweepy.API
api.get_user('name')

我得到错误:

unbound method _call() must be called with API instance as first argument (got str instance instead)

【问题讨论】:

    标签: python twitter tweepy


    【解决方案1】:

    您需要创建 API 的一个实例:

    api = tweepy.API()
    api.get_user('name')
    

    演示总是更有启发性:

    >>> import tweepy
    >>> api = tweepy.API()
    >>> api.get_user('zopatista')
    <tweepy.models.User object at 0x10ffcd910>
    

    【讨论】:

      猜你喜欢
      • 2012-08-21
      • 2017-06-04
      • 2023-01-29
      • 2017-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多