I am trying to get a list of people I follow, and a lost of people I am followed by, but the functions give the same number?
myid = mastodon.account_verify_credentials()["id"]
followed_by = mastodon.account_followers(myid) #Fetch users the given user is followed by.
following = mastodon.account_following(myid) # Fetch users the given user is following.
binoff = []
print ("followed_by={}, following={}, binoff={}".format(len(followed_by),len(following),len(binoff)))
The result is:
followed_by=40, following=40, binoff=0
followed_by=40, following=40, binoff=40
Where have I gone wrong
I discovered the problem. The issue is that there is a rate limit (pagination parameters) on the API. So it only gave me the first 40 accounts. To get the remainder you need to do add the lines:
followed_by = mastodon.fetch_remaining(followed_by)
following = mastodon.fetch_remaining(following)
So the API will pull the remaining accounts for you.