我有这个Python脚本来解析Twitter,它与旧的tweepy版本配合得非常好:
consumer_key = '+++'
consumer_secret = '+++'
access_key = '+++'
access_secret = ''+++'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api = tweepy.API(auth)
json_user_timeline = tweepy.binder.bind_api(
path = '/statuses/user_timeline.json',
payload_type = 'json', payload_list = True,
allowed_param = ['id', 'user_id', 'screen_name', 'since_id', 'max_id', 'count', 'page', 'include_rts'])
d={}
a=[]
h = HTMLParser.HTMLParser()
for tweet in tweepy.Cursor(json_user_timeline, api, screen_name='++user_name++', count=200, include_rts=True).items(200):
.........
.........
现在我升级到了tweepy 2.3,这是错误:
allowed_param = ['id', 'user_id', 'screen_name', 'since_id', 'max_id', 'count', 'page', 'include_rts'])
File "build/bdist.linux-x86_64/egg/tweepy/binder.py", line 21, in bind_api
File "build/bdist.linux-x86_64/egg/tweepy/binder.py", line 23, in APIMethod
KeyError: 'api'
为什么?
非常感谢