From 6a630202db718c5ed2924ad3a3863d7eee391b88 Mon Sep 17 00:00:00 2001 From: halcy Date: Sat, 19 Nov 2022 00:53:25 +0200 Subject: add server rules API --- mastodon/Mastodon.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 4462253..14cf174 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -774,8 +774,7 @@ class Mastodon: """ Basic health check. Returns True if healthy, False if not. """ - status = self.__api_request( - 'GET', '/health', parse=False).decode("utf-8") + status = self.__api_request('GET', '/health', parse=False).decode("utf-8") return status in ["OK", "success"] @api_version("3.0.0", "3.0.0", "3.0.0") @@ -807,6 +806,15 @@ class Mastodon: parse = urlparse(schema_url) return self.__api_request('GET', parse.path + parse.params + parse.query + parse.fragment) + @api_version("3.4.0", "3.4.0", __DICT_VERSION_INSTANCE) + def instance_rules(self): + """ + Retrieve instance rules. + + Returns a list of `id` + `text` dicts, same as the `rules` field in the `instance dicts`_. + """ + return self.__api_request('GET', '/api/v1/instance/rules') + ### # Reading data: Timelines ## -- cgit v1.2.3