diff options
-rw-r--r-- | docs/index.rst | 13 | ||||
-rw-r--r-- | mastodon/Mastodon.py | 29 |
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 | ||
346 | Reading data: Domain blocks | ||
347 | --------------------------- | ||
348 | |||
349 | .. automethod:: Mastodon.domain_blocks | ||
350 | |||
346 | Writing data: Statuses | 351 | Writing data: Statuses |
347 | ---------------------- | 352 | ---------------------- |
348 | These functions allow you to post statuses to Mastodon and to | 353 | These 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 | ||
398 | Writing data: Domain blocks | ||
399 | --------------------------- | ||
400 | These methods allow you to block and unblock all statuses from a domain | ||
401 | for the logged-in user. | ||
402 | |||
403 | .. automethod:: Mastodon.domain_block | ||
404 | .. automethod:: Mastodon.domain_unblock | ||
405 | |||
393 | Streaming | 406 | Streaming |
394 | --------- | 407 | --------- |
395 | These functions allow access to the streaming API. | 408 | These 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): |