diff options
author | Lorenz Diener <[email protected]> | 2018-07-30 16:20:56 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2018-07-30 16:20:56 +0200 |
commit | cf2d0ebc8246cea8c5e1dbb48687b625affe53c8 (patch) | |
tree | a61d748e5d1460d9fac07a1e154c6cc79953780e | |
parent | 300c2882ae00c9cee857e8fa7cbdaaaa00073818 (diff) | |
download | mastodon.py-cf2d0ebc8246cea8c5e1dbb48687b625affe53c8.tar.gz |
Add follow suggestions
-rw-r--r-- | docs/index.rst | 10 | ||||
-rw-r--r-- | mastodon/Mastodon.py | 29 |
2 files changed, 39 insertions, 0 deletions
diff --git a/docs/index.rst b/docs/index.rst index e90c342..6cb782e 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -677,6 +677,11 @@ their relationships. | |||
677 | .. automethod:: Mastodon.account_relationships | 677 | .. automethod:: Mastodon.account_relationships |
678 | .. automethod:: Mastodon.account_search | 678 | .. automethod:: Mastodon.account_search |
679 | 679 | ||
680 | Reading data: Follow suggestions | ||
681 | -------------------------------- | ||
682 | |||
683 | .. automethod:: Mastodon.suggestions | ||
684 | |||
680 | Reading data: Lists | 685 | Reading data: Lists |
681 | ------------------- | 686 | ------------------- |
682 | These functions allow you to view information about lists. | 687 | These functions allow you to view information about lists. |
@@ -774,6 +779,11 @@ These functions allow you to interact with other accounts: To (un)follow and | |||
774 | .. automethod:: Mastodon.account_unmute | 779 | .. automethod:: Mastodon.account_unmute |
775 | .. automethod:: Mastodon.account_update_credentials | 780 | .. automethod:: Mastodon.account_update_credentials |
776 | 781 | ||
782 | Writing data: Follow suggestions | ||
783 | -------------------------------- | ||
784 | |||
785 | .. automethod:: Mastodon.suggestion_delete | ||
786 | |||
777 | Writing data: Lists | 787 | Writing data: Lists |
778 | ------------------- | 788 | ------------------- |
779 | These functions allow you to create, maintain and delete lists. | 789 | These functions allow you to create, maintain and delete lists. |
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 58380fd..5e73622 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -833,6 +833,19 @@ class Mastodon: | |||
833 | return self.__api_request('GET', url, params) | 833 | return self.__api_request('GET', url, params) |
834 | 834 | ||
835 | ### | 835 | ### |
836 | # Reading data: Follow suggestions | ||
837 | ### | ||
838 | @api_version("2.4.3", "2.4.3", __DICT_VERSION_ACCOUNT) | ||
839 | def suggestions(self): | ||
840 | """ | ||
841 | Fetch follow suggestions for the logged-in user. | ||
842 | |||
843 | Returns a list of `user dicts`_. | ||
844 | |||
845 | """ | ||
846 | return self.__api_request('GET', '/api/v1/suggestions') | ||
847 | |||
848 | ### | ||
836 | # Reading data: Searching | 849 | # Reading data: Searching |
837 | ### | 850 | ### |
838 | @api_version("1.1.0", "2.1.0", __DICT_VERSION_SEARCHRESULT) | 851 | @api_version("1.1.0", "2.1.0", __DICT_VERSION_SEARCHRESULT) |
@@ -867,8 +880,11 @@ class Mastodon: | |||
867 | """ | 880 | """ |
868 | Fetch trending-hashtag information, if the instance provides such information. | 881 | Fetch trending-hashtag information, if the instance provides such information. |
869 | 882 | ||
883 | Does not require authentication. | ||
884 | |||
870 | Returns a list of `hashtag dicts`_, sorted by the instances trending algorithm, | 885 | Returns a list of `hashtag dicts`_, sorted by the instances trending algorithm, |
871 | descending. | 886 | descending. |
887 | |||
872 | """ | 888 | """ |
873 | return self.__api_request('GET', '/api/v1/trends') | 889 | return self.__api_request('GET', '/api/v1/trends') |
874 | 890 | ||
@@ -1452,6 +1468,19 @@ class Mastodon: | |||
1452 | params = self.__generate_params(params_initial) | 1468 | params = self.__generate_params(params_initial) |
1453 | return self.__api_request('PATCH', '/api/v1/accounts/update_credentials', params, files=files) | 1469 | return self.__api_request('PATCH', '/api/v1/accounts/update_credentials', params, files=files) |
1454 | 1470 | ||
1471 | |||
1472 | ### | ||
1473 | # Writing data: Follow suggestions | ||
1474 | ### | ||
1475 | @api_version("2.4.3", "2.4.3", __DICT_VERSION_ACCOUNT) | ||
1476 | def suggestion_delete(self, account_id): | ||
1477 | """ | ||
1478 | Remove a single user from the follow suggestions. | ||
1479 | """ | ||
1480 | account_id = self.__unpack_id(account_id) | ||
1481 | url = '/api/v1/suggestions/{0}'.format(str(account_id)) | ||
1482 | self.__api_request('DELETE', url) | ||
1483 | |||
1455 | ### | 1484 | ### |
1456 | # Writing data: Lists | 1485 | # Writing data: Lists |
1457 | ### | 1486 | ### |