Search code examples
pythontwittertwitter-oauthtweepy

Using Tweepy Documentation to find first x followers


Messing around with tweepy. I am creating a desktop application, no callbacks. I want to find the first x followers of a user. Here's what I have so far:

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)

Basically enough to authenticate my application. Reading the documentation, under the 'User methods' section, I see API.followers returns followers 100 at a time. Is there a way to restrict that to x? Like first 5 followers?

Thank you.


Solution

  • api.followers('screen_name')[0:5]
    

    This will return the first 5 followers for the specified 'screen_name' profile.