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 003402f..2e557e4 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -211,6 +211,17 @@ class Mastodon:
211 return response['access_token'] 211 return response['access_token']
212 212
213 ### 213 ###
214 # Reading data: Instance
215 ###
216 def instance(self):
217 """
218 Retrieve basic information about the instance, including the URI and administrative contact email.
219
220 Returns a dict.
221 """
222 return self.__api_request('GET', '/api/v1/instance/')
223
224 ###
214 # Reading data: Timelines 225 # Reading data: Timelines
215 ## 226 ##
216 def timeline(self, timeline = "home", max_id = None, since_id = None, limit = None): 227 def timeline(self, timeline = "home", max_id = None, since_id = None, limit = None):
@@ -274,6 +285,14 @@ class Mastodon:
274 """ 285 """
275 return self.__api_request('GET', '/api/v1/statuses/' + str(id)) 286 return self.__api_request('GET', '/api/v1/statuses/' + str(id))
276 287
288 def status_card(self, id):
289 """
290 Fetch a card associated with a status.
291
292 Returns a card dict.
293 """
294 return self.__api_request('GET', '/api/v1/statuses/' + str(id) + '/card')
295
277 def status_context(self, id): 296 def status_context(self, id):
278 """ 297 """
279 Fetch information about ancestors and descendants of a toot. 298 Fetch information about ancestors and descendants of a toot.
@@ -380,7 +399,6 @@ class Mastodon:
380 """ 399 """
381 params = self.__generate_params(locals()) 400 params = self.__generate_params(locals())
382 return self.__api_request('GET', '/api/v1/accounts/search', params) 401 return self.__api_request('GET', '/api/v1/accounts/search', params)
383
384 402
385 ### 403 ###
386 # Reading data: Searching 404 # Reading data: Searching
@@ -415,6 +433,17 @@ class Mastodon:
415 return self.__api_request('GET', '/api/v1/blocks') 433 return self.__api_request('GET', '/api/v1/blocks')
416 434
417 ### 435 ###
436 # Reading data: Reports
437 ###
438 def reports(self):
439 """
440 Fetch a list of reports made by the authenticated user.
441
442 Returns a list of report dicts.
443 """
444 return self.__api_request('GET', '/api/v1/reports')
445
446 ###
418 # Reading data: Favourites 447 # Reading data: Favourites
419 ### 448 ###
420 def favourites(self): 449 def favourites(self):
@@ -608,6 +637,31 @@ class Mastodon:
608 """ 637 """
609 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute") 638 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute")
610 639
640 def account_update_credentials(self, display_name = None, note = None, avatar = None, header = None):
641 """
642 Update the profile for the currently authenticated user.
643
644 'note' is the user's bio.
645
646 'avatar' and 'header' are PNG images encoded in base64.
647 """
648 params = self.__generate_params(locals())
649 return self.__api_request('POST', '/api/v1/accounts/update_credentials', params)
650
651 ###
652 # Writing data: Reports
653 ###
654 def report(self, id, toots, comment):
655 """
656 Report a user to the admin.
657
658 Accepts a list of toot IDs associated with the report, and a comment.
659
660 Returns a report dict.
661 """
662 params = self.__generate_params(locals())
663 return self.__api_request('POST', '/api/v1/reports/', params)
664
611 ### 665 ###
612 # Writing data: Follow requests 666 # Writing data: Follow requests
613 ### 667 ###
Powered by cgit v1.2.3 (git 2.41.0)