halcy / Mastodon.py

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

Add `offset` parameter for `trending_statuses` #349

Closed Teqed closed 7 months ago

Teqed commented 1 year ago

The functionality of trending_statuses doesn't seem to match Mastodon's /api/v1/trends/statuses API. The described maximum limit is inaccurate, and the offset parameter can't be provided for pagination.

From Mastodon.py's documentation for Mastodon.trending_statuses() at https://mastodonpy.readthedocs.io/en/stable/08_instances.html#mastodon.Mastodon.trending_statuses

  • limit=None, lang=None
    • Specify limit to limit how many results are returned (the maximum number of results is 10, the endpoint is not paginated).
    • Pass lang to override the global locale parameter, which may affect trend ordering.

From Mastodon's API documentation for /api/v1/trends/statuses at https://docs.joinmastodon.org/methods/trends/#statuses

  • Query parameters
    • limit
      • Integer. Maximum number of results to return. Defaults to 20 statuses. Max 40 statuses.
    • offset
      • Integer. Skip the first n results.

I've confirmed that Mastodon v4.1.4's API functions as described by making requests against the API using limit and offset parameters to pull up to 40 statuses at a time and to offset the results.