概述
try: .... for user in tweepy.Cursor(api.followers,screen_name=screenName).items(): .... except tweepy.TweepError as e: errorCode = e.message[0]['code'] if errorCode == 88: print "Rate limit exceeded." rotateKeys()
这里的问题是每次我旋转键时,for循环从头开始并再次开始获得追随者.我试图绕过这个,但拆分for循环:
try: items = tweepy.Cursor(api.followers,screen_name=s).items()
然后我使用next(items)手动循环它们
但是,旋转api键不起作用,因为初始调用是使用第一个API代码完成的,并且将始终尝试使用该API.
current_cursor = cursor.iterator.next_cursor # re-create the cursor using the new api instance cursor = tweepy.Cursor(api.followers,screen_name=s,cursor=current_cursor)
总结
以上是编程之家为你收集整理的python – 使用tweepy和多个API密钥获取Twitter粉丝全部内容,希望文章能够帮你解决python – 使用tweepy和多个API密钥获取Twitter粉丝所遇到的程序开发问题。
如果您也喜欢它,动动您的小指点个赞吧