diff options
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 4f51d0d..6f84b27 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -179,7 +179,7 @@ class Mastodon: | |||
179 | __DICT_VERSION_MEDIA = "2.8.2" | 179 | __DICT_VERSION_MEDIA = "2.8.2" |
180 | __DICT_VERSION_ACCOUNT = "2.4.0" | 180 | __DICT_VERSION_ACCOUNT = "2.4.0" |
181 | __DICT_VERSION_POLL = "2.8.0" | 181 | __DICT_VERSION_POLL = "2.8.0" |
182 | __DICT_VERSION_STATUS = bigger_version(bigger_version(bigger_version(bigger_version(bigger_version("2.8.0", | 182 | __DICT_VERSION_STATUS = bigger_version(bigger_version(bigger_version(bigger_version(bigger_version("2.9.1", |
183 | __DICT_VERSION_MEDIA), __DICT_VERSION_ACCOUNT), __DICT_VERSION_APPLICATION), __DICT_VERSION_MENTION), __DICT_VERSION_POLL) | 183 | __DICT_VERSION_MEDIA), __DICT_VERSION_ACCOUNT), __DICT_VERSION_APPLICATION), __DICT_VERSION_MENTION), __DICT_VERSION_POLL) |
184 | __DICT_VERSION_INSTANCE = bigger_version("2.7.2", __DICT_VERSION_ACCOUNT) | 184 | __DICT_VERSION_INSTANCE = bigger_version("2.7.2", __DICT_VERSION_ACCOUNT) |
185 | __DICT_VERSION_HASHTAG = "2.3.4" | 185 | __DICT_VERSION_HASHTAG = "2.3.4" |
@@ -865,12 +865,12 @@ class Mastodon: | |||
865 | ### | 865 | ### |
866 | # Reading data: Notifications | 866 | # Reading data: Notifications |
867 | ### | 867 | ### |
868 | @api_version("1.0.0", "2.6.0", __DICT_VERSION_NOTIFICATION) | 868 | @api_version("1.0.0", "2.9.0", __DICT_VERSION_NOTIFICATION) |
869 | def notifications(self, id=None, max_id=None, min_id=None, since_id=None, limit=None): | 869 | def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None): |
870 | """ | 870 | """ |
871 | Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in | 871 | Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in |
872 | user. | 872 | user. Pass `account_id` to get only notifications originating from the given account. |
873 | 873 | ||
874 | Can be passed an `id` to fetch a single notification. | 874 | Can be passed an `id` to fetch a single notification. |
875 | 875 | ||
876 | Returns a list of `notification dicts`_. | 876 | Returns a list of `notification dicts`_. |
@@ -884,6 +884,9 @@ class Mastodon: | |||
884 | if since_id != None: | 884 | if since_id != None: |
885 | since_id = self.__unpack_id(since_id) | 885 | since_id = self.__unpack_id(since_id) |
886 | 886 | ||
887 | if account_id != None: | ||
888 | account_id = self.__unpack_id(account_id) | ||
889 | |||
887 | if id is None: | 890 | if id is None: |
888 | params = self.__generate_params(locals(), ['id']) | 891 | params = self.__generate_params(locals(), ['id']) |
889 | return self.__api_request('GET', '/api/v1/notifications', params) | 892 | return self.__api_request('GET', '/api/v1/notifications', params) |
@@ -1606,10 +1609,14 @@ class Mastodon: | |||
1606 | def status_delete(self, id): | 1609 | def status_delete(self, id): |
1607 | """ | 1610 | """ |
1608 | Delete a status | 1611 | Delete a status |
1612 | |||
1613 | Returns the now-deleted status, with an added "source" attribute that contains | ||
1614 | the text that was used to compose this status (this can be used to power | ||
1615 | "delete and redraft" functionality) | ||
1609 | """ | 1616 | """ |
1610 | id = self.__unpack_id(id) | 1617 | id = self.__unpack_id(id) |
1611 | url = '/api/v1/statuses/{0}'.format(str(id)) | 1618 | url = '/api/v1/statuses/{0}'.format(str(id)) |
1612 | self.__api_request('DELETE', url) | 1619 | return self.__api_request('DELETE', url) |
1613 | 1620 | ||
1614 | @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) | 1621 | @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) |
1615 | def status_reblog(self, id, visibility=None): | 1622 | def status_reblog(self, id, visibility=None): |
@@ -2159,10 +2166,10 @@ class Mastodon: | |||
2159 | ### | 2166 | ### |
2160 | # Writing data: Media | 2167 | # Writing data: Media |
2161 | ### | 2168 | ### |
2162 | @api_version("1.0.0", "2.3.0", __DICT_VERSION_MEDIA) | 2169 | @api_version("1.0.0", "2.9.1", __DICT_VERSION_MEDIA) |
2163 | def media_post(self, media_file, mime_type=None, description=None, focus=None): | 2170 | def media_post(self, media_file, mime_type=None, description=None, focus=None): |
2164 | """ | 2171 | """ |
2165 | Post an image. `media_file` can either be image data or | 2172 | Post an image, video or audio file. `media_file` can either be image data or |
2166 | a file name. If image data is passed directly, the mime | 2173 | a file name. If image data is passed directly, the mime |
2167 | type has to be specified manually, otherwise, it is | 2174 | type has to be specified manually, otherwise, it is |
2168 | determined from the file name. `focus` should be a tuple | 2175 | determined from the file name. `focus` should be a tuple |