From 5215c2242dd7b87418a7c10781c2b10b35d86f46 Mon Sep 17 00:00:00 2001 From: halcy Date: Sun, 13 Nov 2022 18:39:56 +0200 Subject: Fix some things in streaming and admin API for 3.3.0 support --- mastodon/Mastodon.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'mastodon/Mastodon.py') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 7db5fba..e84df6d 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -303,7 +303,7 @@ class Mastodon: api_base_url=None, debug_requests=False, ratelimit_method="wait", ratelimit_pacefactor=1.1, request_timeout=__DEFAULT_TIMEOUT, mastodon_version=None, - version_check_mode = "created", session=None, feature_set="mainline", user_agent=None): + version_check_mode = "created", session=None, feature_set="mainline", user_agent="mastodonpy"): """ Create a new API wrapper instance based on the given `client_secret` and `client_id`. If you give a `client_id` and it is not a file, you must also give a secret. If you specify an @@ -349,10 +349,12 @@ class Mastodon: Details are documented in the functions that provide such functionality. Currently supported feature sets are `mainline`, `fedibird` and `pleroma`. - For some mastodon-instances a `User-Agent` header is needed. This can be set by parameter `user_agent`. From now - `create_app()` stores the application name into the client secret file. If `client_id` points to this file, + For some mastodon-instances a `User-Agent` header is needed. This can be set by parameter `user_agent`. Starting from + Mastodon.py 1.5.2 `create_app()` stores the application name into the client secret file. If `client_id` points to this file, the app name will be used as `User-Agent` header as default. It's possible to modify old secret files and append a client app name to use it as a `User-Agent` name. + + If no other user agent is specified, "mastodonpy" will be used. """ self.api_base_url = None if not api_base_url is None: @@ -2870,6 +2872,26 @@ class Mastodon: id = self.__unpack_id(id) return self.__api_request('POST', '/api/v1/admin/accounts/{0}/unsuspend'.format(id)) + @api_version("3.3.0", "3.3.0", __DICT_VERSION_ADMIN_ACCOUNT) + def admin_account_delete(self, id): + """ + Delete a local user account. + + The deleted accounts `admin account dict`_. + """ + id = self.__unpack_id(id) + return self.__api_request('DELETE', '/api/v1/admin/accounts/{0}'.format(id)) + + @api_version("3.3.0", "3.3.0", __DICT_VERSION_ADMIN_ACCOUNT) + def admin_account_unsensitive(self, id): + """ + Unmark an account as force-sensitive. + + Returns the updated `admin account dict`_. + """ + id = self.__unpack_id(id) + return self.__api_request('POST', '/api/v1/admin/accounts/{0}/unsensitive'.format(id)) + @api_version("2.9.1", "2.9.1", "2.9.1") def admin_account_moderate(self, id, action=None, report_id=None, warning_preset_id=None, text=None, send_email_notification=True): """ @@ -2879,6 +2901,7 @@ class Mastodon: * "disable" - for a local user, disable login. * "silence" - hide the users posts from all public timelines. * "suspend" - irreversibly delete all the users posts, past and future. + * "sensitive" - forcce an accounts media visibility to always be sensitive. If no action is specified, the user is only issued a warning. Specify the id of a report as `report_id` to close the report with this moderation action as the resolution. -- cgit v1.2.3