我已经直接从Git安装了tweepy 2.3并且刚开始学习如何使用它但是当我尝试从用户定义的twitter id获取推文时出现错误。这是我的代码:
import tweepy
from tweepy.cursor import Cursor
#Necessary information
consumer_key = "a"
consumer_secret = "b"
access_token = "c"
access_token_secret = "d"
#setup
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
result = Cursor(api.user_timeline, id="BarackObama").items(50)
for status in result:
print(status.text)
我收到此错误:
Traceback (most recent call last):
File "/Applications/Wing101.app/Contents/Resources/src/debug/tserver/_sandbox.py", line 21, in <module>
File "/Library/Python/2.7/site-packages/tweepy-2.3-py2.7.egg/tweepy/cursor.py", line 190, in next
File "/Library/Python/2.7/site-packages/tweepy-2.3-py2.7.egg/tweepy/cursor.py", line 105, in next
AttributeError: 'function' object has no attribute '__self__'