aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErin Congden <[email protected]>2017-04-02 20:20:38 -0700
committerErin Congden <[email protected]>2017-04-02 21:52:41 -0700
commit36781699c135b3a4cd89973ef2f5079f123a0567 (patch)
treeae9c47d2e6d9d09ebf59b18e383f9f50c31710fa
parent9eaf955bfc8bda2a2e114721347f9b2ccf06b055 (diff)
downloadmastodon.py-36781699c135b3a4cd89973ef2f5079f123a0567.tar.gz
Add (un)muting accounts and reading mutes/blocks
-rw-r--r--docs/index.rst11
-rw-r--r--mastodon/Mastodon.py35
2 files changed, 46 insertions, 0 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 90e8478..f9915e6 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -139,6 +139,7 @@ Relationship dicts
139 'following': Boolean denoting whether you follow them 139 'following': Boolean denoting whether you follow them
140 'id': Numerical id (same one as <numerical id>) 140 'id': Numerical id (same one as <numerical id>)
141 'blocking': Boolean denoting whether you are blocking them 141 'blocking': Boolean denoting whether you are blocking them
142 'muting': Boolean denoting whether you are muting them
142 } 143 }
143 144
144Notification dicts 145Notification dicts
@@ -238,6 +239,14 @@ their relationships.
238.. automethod:: Mastodon.account_relationships 239.. automethod:: Mastodon.account_relationships
239.. automethod:: Mastodon.account_search 240.. automethod:: Mastodon.account_search
240 241
242Reading data: Mutes and blocks
243------------------------------
244These functions allow you to get information about accounts that are
245muted or blocked by the logged in user.
246
247.. automethod:: Mastodon.mutes
248.. automethod:: Mastodon.blocks
249
241Writing data: Statuses 250Writing data: Statuses
242---------------------- 251----------------------
243These functions allow you to post statuses to Mastodon and to 252These functions allow you to post statuses to Mastodon and to
@@ -260,6 +269,8 @@ These functions allow you to interact with other accounts: To (un)follow and
260.. automethod:: Mastodon.account_unfollow 269.. automethod:: Mastodon.account_unfollow
261.. automethod:: Mastodon.account_block 270.. automethod:: Mastodon.account_block
262.. automethod:: Mastodon.account_unblock 271.. automethod:: Mastodon.account_unblock
272.. automethod:: Mastodon.account_mute
273.. automethod:: Mastodon.account_unmute
263 274
264Writing data: Media 275Writing data: Media
265------------------- 276-------------------
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 641c415..1c9ca4b 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -330,6 +330,25 @@ class Mastodon:
330 return self.__api_request('GET', '/api/v1/accounts/search', params) 330 return self.__api_request('GET', '/api/v1/accounts/search', params)
331 331
332 ### 332 ###
333 # Reading data: Mutes and Blocks
334 ###
335 def mutes(self):
336 """
337 Fetch a list of users muted by the authenticated user.
338
339 Returns a list of user dicts.
340 """
341 return self.__api_request('GET', '/api/v1/mutes')
342
343 def blocks(self):
344 """
345 Fetch a list of users blocked by the authenticated user.
346
347 Returns a list of user dicts.
348 """
349 return self.__api_request('GET', '/api/v1/blocks')
350
351 ###
333 # Writing data: Statuses 352 # Writing data: Statuses
334 ### 353 ###
335 def status_post(self, status, in_reply_to_id = None, media_ids = None, sensitive = False, visibility = '', spoiler_text = None): 354 def status_post(self, status, in_reply_to_id = None, media_ids = None, sensitive = False, visibility = '', spoiler_text = None):
@@ -462,6 +481,22 @@ class Mastodon:
462 """ 481 """
463 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unblock") 482 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unblock")
464 483
484 def account_mute(self, id):
485 """
486 Mute a user.
487
488 Returns a relationship dict containing the updated relationship to the user.
489 """
490 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/mute")
491
492 def account_unmute(self, id):
493 """
494 Unmute a user.
495
496 Returns a relationship dict containing the updated relationship to the user.
497 """
498 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute")
499
465 ### 500 ###
466 # Writing data: Media 501 # Writing data: Media
467 ### 502 ###
Powered by cgit v1.2.3 (git 2.41.0)