2014-08-27 13 views
0

我试图打印我的twitter朋友列表。我有112个朋友,但我能够打印只有20个朋友的screennames。是不是因为朋友和以下之间的一些API限制/差异/概念error.This是我的代码:叽叽喳喳不完整的朋友列表使用tweepy蟒蛇

import tweepy 
import sys 
import time 
consumer_key = '' 
consumer_secret = '' 
access_token = '' 
access_token_secret = '' 

auth = tweepy.OAuthHandler(consumer_key, consumer_secret) 
auth.set_access_token(access_token, access_token_secret) 
api = tweepy.API(auth) 
data = api.get_user('') 

count = 0 
for friend in data.friends(): 
     print 'Friend:'+ friend.screen_name 
     count=count+1 
     if count%5==0: 
      print count 
     time.sleep(20) 

我的翻译没有抛出任何错误。

回答

1

默认情况下,Twitter每次返回15条记录。为了获得更多的:

  • 问Tweepy更多(count=100) - doc

  • 使用游标在遍历所有的数据;见Tutorial