aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py56
1 files changed, 55 insertions, 1 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 4717674..919825a 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -214,6 +214,17 @@ class Mastodon:
214 return response['access_token'] 214 return response['access_token']
215 215
216 ### 216 ###
217 # Reading data: Instance
218 ###
219 def instance(self):
220 """
221 Retrieve basic information about the instance, including the URI and administrative contact email.
222
223 Returns a dict.
224 """
225 return self.__api_request('GET', '/api/v1/instance/')
226
227 ###
217 # Reading data: Timelines 228 # Reading data: Timelines
218 ## 229 ##
219 def timeline(self, timeline = "home", max_id = None, since_id = None, limit = None): 230 def timeline(self, timeline = "home", max_id = None, since_id = None, limit = None):
@@ -277,6 +288,14 @@ class Mastodon:
277 """ 288 """
278 return self.__api_request('GET', '/api/v1/statuses/' + str(id)) 289 return self.__api_request('GET', '/api/v1/statuses/' + str(id))
279 290
291 def status_card(self, id):
292 """
293 Fetch a card associated with a status.
294
295 Returns a card dict.
296 """
297 return self.__api_request('GET', '/api/v1/statuses/' + str(id) + '/card')
298
280 def status_context(self, id): 299 def status_context(self, id):
281 """ 300 """
282 Fetch information about ancestors and descendants of a toot. 301 Fetch information about ancestors and descendants of a toot.
@@ -392,7 +411,6 @@ class Mastodon:
392 """ 411 """
393 params = self.__generate_params(locals()) 412 params = self.__generate_params(locals())
394 return self.__api_request('GET', '/api/v1/accounts/search', params) 413 return self.__api_request('GET', '/api/v1/accounts/search', params)
395
396 414
397 ### 415 ###
398 # Reading data: Searching 416 # Reading data: Searching
@@ -427,6 +445,17 @@ class Mastodon:
427 return self.__api_request('GET', '/api/v1/blocks') 445 return self.__api_request('GET', '/api/v1/blocks')
428 446
429 ### 447 ###
448 # Reading data: Reports
449 ###
450 def reports(self):
451 """
452 Fetch a list of reports made by the authenticated user.
453
454 Returns a list of report dicts.
455 """
456 return self.__api_request('GET', '/api/v1/reports')
457
458 ###
430 # Reading data: Favourites 459 # Reading data: Favourites
431 ### 460 ###
432 def favourites(self): 461 def favourites(self):
@@ -611,6 +640,31 @@ class Mastodon:
611 """ 640 """
612 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute") 641 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute")
613 642
643 def account_update_credentials(self, display_name = None, note = None, avatar = None, header = None):
644 """
645 Update the profile for the currently authenticated user.
646
647 'note' is the user's bio.
648
649 'avatar' and 'header' are PNG images encoded in base64.
650 """
651 params = self.__generate_params(locals())
652 return self.__api_request('POST', '/api/v1/accounts/update_credentials', params)
653
654 ###
655 # Writing data: Reports
656 ###
657 def report(self, id, toots, comment):
658 """
659 Report a user to the admin.
660
661 Accepts a list of toot IDs associated with the report, and a comment.
662
663 Returns a report dict.
664 """
665 params = self.__generate_params(locals())
666 return self.__api_request('POST', '/api/v1/reports/', params)
667
614 ### 668 ###
615 # Writing data: Follow requests 669 # Writing data: Follow requests
616 ### 670 ###
Powered by cgit v1.2.3 (git 2.41.0)