diff options
author | halcy <halcy@ARARAGI-KUN> | 2022-11-13 18:39:56 +0200 |
---|---|---|
committer | halcy <halcy@ARARAGI-KUN> | 2022-11-13 18:39:56 +0200 |
commit | 5215c2242dd7b87418a7c10781c2b10b35d86f46 (patch) | |
tree | 9164c3963424cc149ddd7e61561470f27f5b817a /mastodon/Mastodon.py | |
parent | 0e00fced99976d74e972a3c9ca5b762697840a33 (diff) | |
download | mastodon.py-5215c2242dd7b87418a7c10781c2b10b35d86f46.tar.gz |
Fix some things in streaming and admin API for 3.3.0 support
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r-- | mastodon/Mastodon.py | 29 |
1 files changed, 26 insertions, 3 deletions
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: | |||
303 | api_base_url=None, debug_requests=False, | 303 | api_base_url=None, debug_requests=False, |
304 | ratelimit_method="wait", ratelimit_pacefactor=1.1, | 304 | ratelimit_method="wait", ratelimit_pacefactor=1.1, |
305 | request_timeout=__DEFAULT_TIMEOUT, mastodon_version=None, | 305 | request_timeout=__DEFAULT_TIMEOUT, mastodon_version=None, |
306 | version_check_mode = "created", session=None, feature_set="mainline", user_agent=None): | 306 | version_check_mode = "created", session=None, feature_set="mainline", user_agent="mastodonpy"): |
307 | """ | 307 | """ |
308 | Create a new API wrapper instance based on the given `client_secret` and `client_id`. If you | 308 | Create a new API wrapper instance based on the given `client_secret` and `client_id`. If you |
309 | give a `client_id` and it is not a file, you must also give a secret. If you specify an | 309 | 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: | |||
349 | Details are documented in the functions that provide such functionality. Currently supported feature | 349 | Details are documented in the functions that provide such functionality. Currently supported feature |
350 | sets are `mainline`, `fedibird` and `pleroma`. | 350 | sets are `mainline`, `fedibird` and `pleroma`. |
351 | 351 | ||
352 | For some mastodon-instances a `User-Agent` header is needed. This can be set by parameter `user_agent`. From now | 352 | For some mastodon-instances a `User-Agent` header is needed. This can be set by parameter `user_agent`. Starting from |
353 | `create_app()` stores the application name into the client secret file. If `client_id` points to this file, | 353 | Mastodon.py 1.5.2 `create_app()` stores the application name into the client secret file. If `client_id` points to this file, |
354 | the app name will be used as `User-Agent` header as default. It's possible to modify old secret files and append | 354 | the app name will be used as `User-Agent` header as default. It's possible to modify old secret files and append |
355 | a client app name to use it as a `User-Agent` name. | 355 | a client app name to use it as a `User-Agent` name. |
356 | |||
357 | If no other user agent is specified, "mastodonpy" will be used. | ||
356 | """ | 358 | """ |
357 | self.api_base_url = None | 359 | self.api_base_url = None |
358 | if not api_base_url is None: | 360 | if not api_base_url is None: |
@@ -2870,6 +2872,26 @@ class Mastodon: | |||
2870 | id = self.__unpack_id(id) | 2872 | id = self.__unpack_id(id) |
2871 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/unsuspend'.format(id)) | 2873 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/unsuspend'.format(id)) |
2872 | 2874 | ||
2875 | @api_version("3.3.0", "3.3.0", __DICT_VERSION_ADMIN_ACCOUNT) | ||
2876 | def admin_account_delete(self, id): | ||
2877 | """ | ||
2878 | Delete a local user account. | ||
2879 | |||
2880 | The deleted accounts `admin account dict`_. | ||
2881 | """ | ||
2882 | id = self.__unpack_id(id) | ||
2883 | return self.__api_request('DELETE', '/api/v1/admin/accounts/{0}'.format(id)) | ||
2884 | |||
2885 | @api_version("3.3.0", "3.3.0", __DICT_VERSION_ADMIN_ACCOUNT) | ||
2886 | def admin_account_unsensitive(self, id): | ||
2887 | """ | ||
2888 | Unmark an account as force-sensitive. | ||
2889 | |||
2890 | Returns the updated `admin account dict`_. | ||
2891 | """ | ||
2892 | id = self.__unpack_id(id) | ||
2893 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/unsensitive'.format(id)) | ||
2894 | |||
2873 | @api_version("2.9.1", "2.9.1", "2.9.1") | 2895 | @api_version("2.9.1", "2.9.1", "2.9.1") |
2874 | def admin_account_moderate(self, id, action=None, report_id=None, warning_preset_id=None, text=None, send_email_notification=True): | 2896 | def admin_account_moderate(self, id, action=None, report_id=None, warning_preset_id=None, text=None, send_email_notification=True): |
2875 | """ | 2897 | """ |
@@ -2879,6 +2901,7 @@ class Mastodon: | |||
2879 | * "disable" - for a local user, disable login. | 2901 | * "disable" - for a local user, disable login. |
2880 | * "silence" - hide the users posts from all public timelines. | 2902 | * "silence" - hide the users posts from all public timelines. |
2881 | * "suspend" - irreversibly delete all the users posts, past and future. | 2903 | * "suspend" - irreversibly delete all the users posts, past and future. |
2904 | * "sensitive" - forcce an accounts media visibility to always be sensitive. | ||
2882 | If no action is specified, the user is only issued a warning. | 2905 | If no action is specified, the user is only issued a warning. |
2883 | 2906 | ||
2884 | Specify the id of a report as `report_id` to close the report with this moderation action as the resolution. | 2907 | Specify the id of a report as `report_id` to close the report with this moderation action as the resolution. |