1

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

Brian Tompsett - 汤莱恩
5,92772 gold badges64 silver badges135 bronze badges
asked Aug 6, 2023 at 9:02
1
  • Could you include myid if possible? Also, a sample of followed_by or following would be nice. Have you tried on another user's id? Commented Aug 6, 2023 at 9:47

1 Answer 1

1

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.

answered Aug 6, 2023 at 12:02
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.