我对tweepy和分页使用游标类相当陌生。我一直在尝试使用光标类来获取特定twitter用户的所有追随者,但是我一直收到错误,它说"tweepy.error.TweepError: This method does not perform pagination"
因此,如果有人可以帮助我实现获取所有一个特定的twitter用户的分页,使用tweepy的追随者。我到目前为止的代码如下:关于特定twitter用户的tweepy(get_followers)中的分页查询
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']
您是否有机会获得有关您如何创建分页功能的更多信息的链接?我一直在寻找一种很好的方法来做到这一点。谢谢! –
@KyleSponable很久以前,但看看[这个线程](http://stackoverflow.com/questions/3744451/is-this-how-you-paginate-or-is-there-a-better-算法) - 我认为这是我使用'paginate()'函数的地方。 – alecxe
@alecxe这是否允许解决极限问题? –