The code I'm trying to write requires a list of all accounts following me, but the one I've written only gets precisely 193 out of 313:
followers = api.user_followers(api.authenticated_user_id, rank_token = Client.generate_uuid())
myFollowers = []
for i in range(len(followers['users'])):
myFollowers.append(followers['users'][i]['username'])
print(myFollowers)
What can I change to get all the followers?
You can fetch all users using "max_id" parameter. Please check the code below.
myFollowers = []
next_max_id = "0"
while next_max_id != None :
followers = api.user_followers(api.authenticated_user_id, rank_token = Client.generate_uuid(), max_id=next_max_id)
next_max_id = followers.get('next_max_id')
for i in range(len(followers['users'])):
myFollowers.append(followers['users'][i]['username'])
print(myFollowers)