尝试使用twitter python库获取具有用户id的关注者

2024-04-23 15:18:49 发布

您现在位置:Python中文网/ 问答频道 /正文

所以,我一直在尝试使用twitter库获取带有GetFollowers函数的朋友列表。在

try:
    print "3"
    pos=random.randint(0,len(idList)-1)
    print i
    followersList=self.api.GetFollowers(user_id=i,count=5)
    print followersList
    print "4"
    for x in followersList:
        print str(x.user.followers_count)
        print "addedf " + str(x.user.screen_name)
        if x.user.followers_count>self.minFavoriteReq:
            self.api.CreateFriendship(user_id=x.user.id)
            print "added " + str(x.user.screen_name)


except Exception as e:
    print e
    print "trying to add new follower"

我好像被函数调用卡住了。没有异常被抛出,我只是打印“I”然后它就被保留了。我不知道它为什么不回来,或者我能做些什么让它开始。也许有人比我更有经验。在

文档可以在https://github.com/bear/python-twitter找到


Tags: 函数nameselfapiidcount朋友twitter