From aa3e678c7b8306f1922a2b6de1198b3e677b8d01 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Thu, 15 Jun 2017 23:13:34 +0200 Subject: Domain blocking + documentation --- mastodon/Mastodon.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 3cf889a..e66711b 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -467,6 +467,18 @@ class Mastodon: params = self.__generate_params(locals()) return self.__api_request('GET', '/api/v1/follow_requests', params) + ### + # Reading data: Domain blocks + ### + def domain_blocks(self, max_id = None, since_id = None, limit = None): + """ + Fetch the authenticated user's blocked domain. + + Returns a list of blocked domain URLs. + """ + params = self.__generate_params(locals()) + return self.__api_request('GET', '/api/v1/domain_blocks', params) + ### # Writing data: Statuses ### @@ -713,6 +725,23 @@ class Mastodon: media_file_description = (file_name, media_file, mime_type) return self.__api_request('POST', '/api/v1/media', files = {'file': media_file_description}) + ### + # Writing data: Domain blocks + ### + def domain_block(self, domain = None): + """ + Add a block for all statuses originating from the specified domain for the logged-in user. + """ + params = self.__generate_params(locals()) + return self.__api_request('POST', '/api/v1/domain_blocks', params) + + def domain_unblock(self, domain = None): + """ + Remove a domain block for the logged-in user. + """ + params = self.__generate_params(locals()) + return self.__api_request('DELETE', '/api/v1/domain_blocks', params) + ### # Streaming ### -- cgit v1.2.3