From 3194b1295e8f4a6d151d18ad4f23174c63408c05 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sat, 12 Oct 2019 21:02:39 +0200 Subject: Re-add and test trends API --- mastodon/Mastodon.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 1561fa1..899aae4 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -1312,6 +1312,28 @@ class Mastodon: return self.__api_request('GET', '/api/v2/search', params) + ### + # Reading data: Trends + ### + @api_version("2.4.3", "3.0.0", __DICT_VERSION_HASHTAG) + def trends(self, limit = None): + """ + Fetch trending-hashtag information, if the instance provides such information. + + Specify `limit` to limit how many results are returned (the maximum number + of results is 10, the endpoint is not paginated). + + Does not require authentication unless locked down by the administrator. + + Important versioning note: This endpoint does not exist for Mastodon versions + between 2.8.0 (inclusive) and 3.0.0 (exclusive). + + Returns a list of `hashtag dicts`_, sorted by the instances trending algorithm, + descending. + """ + params = self.__generate_params(locals()) + return self.__api_request('GET', '/api/v1/trends', params) + ### # Reading data: Lists ### -- cgit v1.2.3