halcy / Mastodon.py

Python wrapper for the Mastodon ( https://github.com/mastodon/mastodon/ ) API.
MIT License
884 stars 151 forks source link

account_following limited to 40 entries #376

Open helioloureiro opened 4 months ago

helioloureiro commented 4 months ago

Hi,

Not sure whether I've some issue, or it is located on the instance (I use mastodon.social), but when I call account_following, I only get 40 entries. And my profile has more than 500.

In [14]: u = tt.mastodon.account_following(id=tt.me.id)

In [15]: len(u)
Out[15]: 40

I tried to set limit as None, but it didn't change much.

Here is my profile at mastodon where you can see it has much higher number of followings:

image

helioloureiro commented 4 months ago

And I tried to increase by limit.

In [16]: u = tt.mastodon.account_following(id=tt.me.id, limit=80)

In [17]: len(u)
Out[17]: 80

In [18]: u = tt.mastodon.account_following(id=tt.me.id, limit=500)

In [19]: len(u)
Out[19]: 80

So at the least I'm getting the double as before, but it stills much smaller. Could this be related to https://github.com/halcy/Mastodon.py/issues/300 ?

helioloureiro commented 4 months ago

I changed the code to use the result from account_following( ) as argument to fetch_remaining( ) and it did the trick.

So my suggestion for improvement is to inform it on documentation.

In [14]: u = tt.mastodon.account_following(id=tt.me.id, limit=None)

In [15]: len(u)
Out[15]: 40

In [16]: u = tt.mastodon.account_following(id=tt.me.id, limit=80)

In [17]: len(u)
Out[17]: 80

In [18]: u = tt.mastodon.account_following(id=tt.me.id, limit=500)

In [19]: len(u)
Out[19]: 80

In [20]: u2 = tt.mastodon.fetch_remaining(u)

In [21]: len(u2)
Out[21]: 525