aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mastodon/Mastodon.py60
1 files changed, 20 insertions, 40 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 5cd2c7b..77deef9 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -3263,24 +3263,14 @@ 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) 3266 @api_version("4.0.0","4.0.0","4.0.0")
3267 def admin_domain_blocks(self, id=None): 3267 def admin_domain_blocks(self, id=None):
3268 """ 3268 """
3269 Fetches a list of blocked domains 3269 Fetches a list of blocked domains
3270 3270
3271 * Set `remote` to True to get remote accounts, otherwise local accounts are returned (default: local accounts) 3271 Provide an `id` to fetch a specific domain block based on its database id.
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 3272
3280 Note that setting the boolean parameters to False does not mean "give me users to which this does not apply" but 3273 Returns a list of `domain dicts`_.
3281 instead means "I do not care if users have this attribute".
3282
3283 Returns a list of `admin account dicts`_.
3284 """ 3274 """
3285 id = self.__unpack_id(id) 3275 id = self.__unpack_id(id)
3286 if id is not None: 3276 if id is not None:
@@ -3288,42 +3278,32 @@ class Mastodon:
3288 else 3278 else
3289 return self.__api_request('GET', '/api/v1/admin/domain_blocks/'.format(id)) 3279 return self.__api_request('GET', '/api/v1/admin/domain_blocks/'.format(id))
3290 3280
3291 @api_version("2.9.1", "2.9.1", "2.9.1") 3281 @api_version("4.0.0","4.0.0","4.0.0")
3292 def admin_domain_block(self, domain: str, severity=None, reject_media=None, reject_reports=None, private_comment=None, public_comment=None, obfuscate=None): 3282 def admin_domain_block(self, domain: str, severity=None, reject_media=None, reject_reports=None, private_comment=None, public_comment=None, obfuscate=None):
3293 """ 3283 """
3294 Perform a moderation action on an account. 3284 Perform a moderation action on a domain.
3295 3285
3296 Valid actions are: 3286 Valid severities are:
3297 * "disable" - for a local user, disable login. 3287 * "silence" - hide all posts from federated timelines and do not show notifications to local users from the remote instance's users unless they are following the remote user.
3298 * "silence" - hide the users posts from all public timelines. 3288 * "suspend" - deny interactions with this instance going forward. This action is reversible.
3299 * "suspend" - irreversibly delete all the user's posts, past and future. 3289 * "limit" - generally used with reject_media=true to force reject media from an instance without silencing or suspending..
3300 * "sensitive" - forcce an accounts media visibility to always be sensitive.
3301 3290
3302 If no action is specified, the user is only issued a warning. 3291 If no action is specified, the domain is only silenced.
3303 3292 `domain` is the domain to block. Note that using the top level domain will also imapct all subdomains. ie, example.com will also impact subdomain.example.com.
3304 Specify the id of a report as `report_id` to close the report with this moderation action as the resolution. 3293 `reject_media` will not download remote media on to your local instance media storage.
3305 Specify `warning_preset_id` to use a warning preset as the notification text to the user, or `text` to specify text directly. 3294 `reject_reports` ignores all reports from the remote instance.
3306 If both are specified, they are concatenated (preset first). Note that there is currently no API to retrieve or create 3295 `private_comment` sets a private admin comment for the domain.
3307 warning presets. 3296 `public_comment` sets a publicly available comment for this domain, which will be available to local users and may be available to everyone depending on your settings.
3308 3297 `obfuscate` sensors some part of the domain name. Useful if the domain name contains unwanted words like slurs.
3309 Set `send_email_notification` to False to not send the user an email notification informing them of the moderation action.
3310 """ 3298 """
3311 if action is None: 3299 if domain is None:
3312 action = "none" 3300 raise AttributeError("Must provide a domain to block a domain")
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 3301
3321 params = self.__generate_params(locals(), ['id', 'action']) 3302 params = self.__generate_params(locals())
3322 3303
3323 params["type"] = action
3324 3304
3325 self.__api_request( 3305 self.__api_request(
3326 'POST', '/api/v1/admin/accounts/{0}/action'.format(id), params) 3306 'POST', '/api/v1/admin/domain_block/, params)
3327 3307
3328 ### 3308 ###
3329 # Push subscription crypto utilities 3309 # Push subscription crypto utilities
Powered by cgit v1.2.3 (git 2.41.0)