From f7227780959c52fe36b5bd189db12856b31ec35e Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Thu, 23 Sep 2021 13:31:58 +0900 Subject: [PATCH 1/2] Support tagged, exclude_reblogs parameter on account_statuses --- mastodon/Mastodon.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 1645225..bb49978 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -1062,8 +1062,8 @@ class Mastodon: """ return self.account_verify_credentials() - @api_version("1.0.0", "2.7.0", __DICT_VERSION_STATUS) - def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, max_id=None, min_id=None, since_id=None, limit=None): + @api_version("1.0.0", "2.8.0", __DICT_VERSION_STATUS) + def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, max_id=None, min_id=None, since_id=None, limit=None, exclude_reblogs=False, tagged=None): """ Fetch statuses by user `id`. Same options as `timeline()`_ are permitted. Returned toots are from the perspective of the logged-in user, i.e. @@ -1074,6 +1074,8 @@ class Mastodon: If `pinned` is set, return only statuses that have been pinned. Note that as of Mastodon 2.1.0, this only works properly for instance-local users. If `exclude_replies` is set, filter out all statuses that are replies. + If `exclude_reblogs` is set, filter out all statuses that are reblogs. + If `tagged` is set, return only statuses that are tagged with `tagged`. Does not require authentication for Mastodon versions after 2.7.0 (returns publicly visible statuses in that case), for publicly visible accounts. @@ -1097,6 +1099,10 @@ class Mastodon: del params["only_media"] if exclude_replies == False: del params["exclude_replies"] + if exclude_reblogs == False: + del params["exclude_reblogs"] + if tagged is None: + del params["tagged"] url = '/api/v1/accounts/{0}/statuses'.format(str(id)) return self.__api_request('GET', url, params) From 61e1a8e4508c95eaede19560a4479b2357ae2594 Mon Sep 17 00:00:00 2001 From: Aljoscha Rittner Date: Tue, 28 Jun 2022 13:19:10 +0200 Subject: [PATCH 2/2] Fixed PR and changed the doc-string --- mastodon/Mastodon.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index bb49978..d37d437 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -1063,7 +1063,7 @@ class Mastodon: return self.account_verify_credentials() @api_version("1.0.0", "2.8.0", __DICT_VERSION_STATUS) - def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, max_id=None, min_id=None, since_id=None, limit=None, exclude_reblogs=False, tagged=None): + def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, exclude_reblogs=False, tagged=None, max_id=None, min_id=None, since_id=None, limit=None): """ Fetch statuses by user `id`. Same options as `timeline()`_ are permitted. Returned toots are from the perspective of the logged-in user, i.e. @@ -1075,7 +1075,7 @@ class Mastodon: as of Mastodon 2.1.0, this only works properly for instance-local users. If `exclude_replies` is set, filter out all statuses that are replies. If `exclude_reblogs` is set, filter out all statuses that are reblogs. - If `tagged` is set, return only statuses that are tagged with `tagged`. + If `tagged` is set, return only statuses that are tagged with `tagged`. Only a single tag without a '#' is valid. Does not require authentication for Mastodon versions after 2.7.0 (returns publicly visible statuses in that case), for publicly visible accounts. @@ -1101,9 +1101,7 @@ class Mastodon: del params["exclude_replies"] if exclude_reblogs == False: del params["exclude_reblogs"] - if tagged is None: - del params["tagged"] - + url = '/api/v1/accounts/{0}/statuses'.format(str(id)) return self.__api_request('GET', url, params)