aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-06-15 23:13:34 +0200
committerLorenz Diener <[email protected]>2017-06-15 23:13:34 +0200
commitaa3e678c7b8306f1922a2b6de1198b3e677b8d01 (patch)
tree18d1a0f58d94b13434c9b3df7a7bf051845e4243
parentb57b66ebb5dc83b2b1f7c8624d31e605eb6e6c43 (diff)
downloadmastodon.py-aa3e678c7b8306f1922a2b6de1198b3e677b8d01.tar.gz
Domain blocking + documentation
-rw-r--r--docs/index.rst13
-rw-r--r--mastodon/Mastodon.py29
2 files changed, 42 insertions, 0 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 90cc8e2..c59940d 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -343,6 +343,11 @@ Reading data: Reports
343 343
344.. automethod:: Mastodon.reports 344.. automethod:: Mastodon.reports
345 345
346Reading data: Domain blocks
347---------------------------
348
349.. automethod:: Mastodon.domain_blocks
350
346Writing data: Statuses 351Writing data: Statuses
347---------------------- 352----------------------
348These functions allow you to post statuses to Mastodon and to 353These functions allow you to post statuses to Mastodon and to
@@ -390,6 +395,14 @@ Writing data: Reports
390 395
391.. automethod:: Mastodon.report 396.. automethod:: Mastodon.report
392 397
398Writing data: Domain blocks
399---------------------------
400These methods allow you to block and unblock all statuses from a domain
401for the logged-in user.
402
403.. automethod:: Mastodon.domain_block
404.. automethod:: Mastodon.domain_unblock
405
393Streaming 406Streaming
394--------- 407---------
395These functions allow access to the streaming API. 408These functions allow access to the streaming API.
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 3cf889a..e66711b 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -468,6 +468,18 @@ class Mastodon:
468 return self.__api_request('GET', '/api/v1/follow_requests', params) 468 return self.__api_request('GET', '/api/v1/follow_requests', params)
469 469
470 ### 470 ###
471 # Reading data: Domain blocks
472 ###
473 def domain_blocks(self, max_id = None, since_id = None, limit = None):
474 """
475 Fetch the authenticated user's blocked domain.
476
477 Returns a list of blocked domain URLs.
478 """
479 params = self.__generate_params(locals())
480 return self.__api_request('GET', '/api/v1/domain_blocks', params)
481
482 ###
471 # Writing data: Statuses 483 # Writing data: Statuses
472 ### 484 ###
473 def status_post(self, status, in_reply_to_id = None, media_ids = None, sensitive = False, visibility = '', spoiler_text = None): 485 def status_post(self, status, in_reply_to_id = None, media_ids = None, sensitive = False, visibility = '', spoiler_text = None):
@@ -714,6 +726,23 @@ class Mastodon:
714 return self.__api_request('POST', '/api/v1/media', files = {'file': media_file_description}) 726 return self.__api_request('POST', '/api/v1/media', files = {'file': media_file_description})
715 727
716 ### 728 ###
729 # Writing data: Domain blocks
730 ###
731 def domain_block(self, domain = None):
732 """
733 Add a block for all statuses originating from the specified domain for the logged-in user.
734 """
735 params = self.__generate_params(locals())
736 return self.__api_request('POST', '/api/v1/domain_blocks', params)
737
738 def domain_unblock(self, domain = None):
739 """
740 Remove a domain block for the logged-in user.
741 """
742 params = self.__generate_params(locals())
743 return self.__api_request('DELETE', '/api/v1/domain_blocks', params)
744
745 ###
717 # Streaming 746 # Streaming
718 ### 747 ###
719 def user_stream(self, listener): 748 def user_stream(self, listener):
Powered by cgit v1.2.3 (git 2.41.0)