aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py56
1 files changed, 49 insertions, 7 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 77deef9..3d04955 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -3264,24 +3264,25 @@ class Mastodon:
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("4.0.0","4.0.0","4.0.0") 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:str=None, limit:int=None):
3268 """ 3268 """
3269 Fetches a list of blocked domains 3269 Fetches a list of blocked domains. Requires scope `admin:read:domain_blocks`.
3270 3270
3271 Provide an `id` to fetch a specific domain block based on its database id. 3271 Provide an `id` to fetch a specific domain block based on its database id.
3272 3272
3273 Returns a list of `domain dicts`_. 3273 Returns a list of `domain dicts`_, or 404 if a domain is queried for and not found.
3274 """ 3274 """
3275 id = self.__unpack_id(id) 3275 id = self.__unpack_id(id)
3276 if id is not None: 3276 if id is not None:
3277 return self.__api_request('GET', '/api/v1/admin/domain_blocks/{0}'.format(id)) 3277 return self.__api_request('GET', '/api/v1/admin/domain_blocks/{0}'.format(id))
3278 else 3278 else
3279 return self.__api_request('GET', '/api/v1/admin/domain_blocks/'.format(id)) 3279 params = params = self.__generate_params(locals(),['limit'])
3280 return self.__api_request('GET', '/api/v1/admin/domain_blocks/')
3280 3281
3281 @api_version("4.0.0","4.0.0","4.0.0") 3282 @api_version("4.0.0","4.0.0","4.0.0")
3282 def admin_domain_block(self, domain: str, severity=None, reject_media=None, reject_reports=None, private_comment=None, public_comment=None, obfuscate=None): 3283 def admin_domain_block(self, domain:str, severity:str=None, reject_media:bool=None, reject_reports:bool=None, private_comment:str=None, public_comment:str=None, obfuscate:bool=None):
3283 """ 3284 """
3284 Perform a moderation action on a domain. 3285 Perform a moderation action on a domain.
3285 3286
3286 Valid severities are: 3287 Valid severities are:
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. 3288 * "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.
@@ -3303,7 +3304,48 @@ class Mastodon:
3303 3304
3304 3305
3305 self.__api_request( 3306 self.__api_request(
3306 'POST', '/api/v1/admin/domain_block/, params) 3307 'POST', '/api/v1/admin/domain_blocks/, params)
3308
3309 @api_version("4.0.0","4.0.0","4.0.0")
3310 def admin_update_domain_block(self, id:str, severity:str=None, reject_media:bool=None, reject_reports:bool=None, private_comment:str=None, public_comment:str=None, obfuscate:bool=None):
3311 """
3312 Modify existing moderation action on a domain.
3313
3314 Valid severities are:
3315 * "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.
3316 * "suspend" - deny interactions with this instance going forward. This action is reversible.
3317 * "limit" - generally used with reject_media=true to force reject media from an instance without silencing or suspending..
3318
3319 If no action is specified, the domain is only silenced.
3320 `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.
3321 `reject_media` will not download remote media on to your local instance media storage.
3322 `reject_reports` ignores all reports from the remote instance.
3323 `private_comment` sets a private admin comment for the domain.
3324 `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.
3325 `obfuscate` sensors some part of the domain name. Useful if the domain name contains unwanted words like slurs.
3326 """
3327 if id is None:
3328 raise AttributeError("Must provide an id to modify the existing moderation actions on a given domain.")
3329
3330 params = self.__generate_params(locals())
3331
3332 self.__api_request(
3333 'PUT', '/api/v1/admin/domain_blocks/, params)
3334
3335 @api_version("4.0.0","4.0.0","4.0.0")
3336 def admin_delete_domain_blocks(self, id:str=None):
3337 """
3338 Removes moderation action against a given domain. Requires scope `admin:write:domain_blocks`.
3339
3340 Provide an `id` to remove a specific domain block based on its database id.
3341
3342 Returns 200 OK if successful.
3343 """
3344 id = self.__unpack_id(id)
3345 if id is not None:
3346 return self.__api_request('DELETE', '/api/v1/admin/domain_blocks/{0}'.format(id))
3347 else
3348 raise AttributeError("You must provide an id of an existing domain block to remove it.")
3307 3349
3308 ### 3350 ###
3309 # Push subscription crypto utilities 3351 # Push subscription crypto utilities
Powered by cgit v1.2.3 (git 2.41.0)