api = twitter.Api() AttributeError: 'module' object has no attribute 'Api

后端 未结 7 1152
借酒劲吻你
借酒劲吻你 2020-12-17 10:14

I have been trying to write a simple mention grabber to get started with the twitter Api. Howsoever I\'ve been experienceing some difficulties when initializing the Api. Run

7条回答
  •  清歌不尽
    2020-12-17 10:40

    I think you've installed one twitter package, and look at another documentation. Ie: python-1.7.2 is the project from https://github.com/sixohsix/twitter, while you're looking at the http://code.google.com/p/python-twitter/ documentation. No match between both :)

    So for the one you've installed, if you check the source code, a stream example is available, and other various examples in the pydoc:

      from twitter import Twitter
      # ...
      twitter = Twitter(
          auth=OAuth(token, token_key, con_secret, con_secret_key)))
    
      # Get the public timeline
      twitter.statuses.public_timeline()
    

提交回复
热议问题