aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormicah <[email protected]>2022-11-24 02:21:00 +0000
committermicah <[email protected]>2022-11-24 02:21:00 +0000
commit038181fdd1f555d7d0123e6075e874e3d8754ce7 (patch)
tree5a0fc50604038735b0117f2b3d974289b29fc953
parent5d7ca19c30dc6579bf29610fe815b822889978e6 (diff)
downloadmastodon.py-038181fdd1f555d7d0123e6075e874e3d8754ce7.tar.gz
start to add domain blocks
-rw-r--r--mastodon/Mastodon.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index f0d9cc5..5cd2c7b 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -3263,6 +3263,68 @@ class Mastodon:
3263 id = self.__unpack_id(id) 3263 id = self.__unpack_id(id)
3264 return self.__api_request('POST', '/api/v1/admin/reports/{0}/resolve'.format(id)) 3264 return self.__api_request('POST', '/api/v1/admin/reports/{0}/resolve'.format(id))
3265 3265
3266 @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT)
3267 def admin_domain_blocks(self, id=None):
3268 """
3269 Fetches a list of blocked domains
3270
3271 * Set `remote` to True to get remote accounts, otherwise local accounts are returned (default: local accounts)
3272 * Set `by_domain` to a domain to get only accounts from that domain.
3273 * Set `status` to one of "active", "pending", "disabled", "silenced" or "suspended" to get only accounts with that moderation status (default: active)
3274 * Set `username` to a string to get only accounts whose username contains this string.
3275 * Set `display_name` to a string to get only accounts whose display name contains this string.
3276 * Set `email` to an email to get only accounts with that email (this only works on local accounts).
3277 * Set `ip` to an ip (as a string, standard v4/v6 notation) to get only accounts whose last active ip is that ip (this only works on local accounts).
3278 * Set `staff_only` to True to only get staff accounts (this only works on local accounts).
3279
3280 Note that setting the boolean parameters to False does not mean "give me users to which this does not apply" but
3281 instead means "I do not care if users have this attribute".
3282
3283 Returns a list of `admin account dicts`_.
3284 """
3285 id = self.__unpack_id(id)
3286 if id is not None:
3287 return self.__api_request('GET', '/api/v1/admin/domain_blocks/{0}'.format(id))
3288 else
3289 return self.__api_request('GET', '/api/v1/admin/domain_blocks/'.format(id))
3290
3291 @api_version("2.9.1", "2.9.1", "2.9.1")
3292 def admin_domain_block(self, domain: str, severity=None, reject_media=None, reject_reports=None, private_comment=None, public_comment=None, obfuscate=None):
3293 """
3294 Perform a moderation action on an account.
3295
3296 Valid actions are:
3297 * "disable" - for a local user, disable login.
3298 * "silence" - hide the users posts from all public timelines.
3299 * "suspend" - irreversibly delete all the user's posts, past and future.
3300 * "sensitive" - forcce an accounts media visibility to always be sensitive.
3301
3302 If no action is specified, the user is only issued a warning.
3303
3304 Specify the id of a report as `report_id` to close the report with this moderation action as the resolution.
3305 Specify `warning_preset_id` to use a warning preset as the notification text to the user, or `text` to specify text directly.
3306 If both are specified, they are concatenated (preset first). Note that there is currently no API to retrieve or create
3307 warning presets.
3308
3309 Set `send_email_notification` to False to not send the user an email notification informing them of the moderation action.
3310 """
3311 if action is None:
3312 action = "none"
3313
3314 if not send_email_notification:
3315 send_email_notification = None
3316
3317 id = self.__unpack_id(id)
3318 if report_id is not None:
3319 report_id = self.__unpack_id(report_id)
3320
3321 params = self.__generate_params(locals(), ['id', 'action'])
3322
3323 params["type"] = action
3324
3325 self.__api_request(
3326 'POST', '/api/v1/admin/accounts/{0}/action'.format(id), params)
3327
3266 ### 3328 ###
3267 # Push subscription crypto utilities 3329 # Push subscription crypto utilities
3268 ### 3330 ###
Powered by cgit v1.2.3 (git 2.41.0)