我对使用游标类的 tweepy 和分页相当陌生。我一直在尝试使用游标类来获取特定 twitter 用户的所有关注者,但我不断收到错误消息"tweepy.error.TweepError: This method does not perform pagination"
因此,如果有人可以帮助我完成获得所有关注者的任务,我将不胜感激具有分页功能的特定 Twitter 用户,使用 tweepy。我到目前为止的代码如下:
import tweepy
consumer_key='xyz'
consumer_secret='xyz'
access_token='abc'
access_token_secret='def'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
user = api.get_user('somehandle')
print user.name
followers = tweepy.Cursor(user.followers)
temp=[]
for user in followers.items():
temp.append(user)
print temp
#the following part works fine but that is without pagination so I will be able to retrieve at #most 100 followers
aDict = user.followers()
for friend in aDict:
friendDict = friend.__getstate__()
print friendDict['screen_name']