From f42032dafcefd422d3819ace721accf75f2d0c91 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Fri, 11 Oct 2019 22:07:51 +0200 Subject: Add new card behaviour, freeze old test --- mastodon/Mastodon.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 91f5125..7f9a008 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -784,7 +784,7 @@ class Mastodon: url = '/api/v1/statuses/{0}'.format(str(id)) return self.__api_request('GET', url) - @api_version("1.0.0", "1.0.0", __DICT_VERSION_CARD) + @api_version("1.0.0", "3.0.0", __DICT_VERSION_CARD) def status_card(self, id): """ Fetch a card associated with a status. A card describes an object (such as an @@ -792,11 +792,19 @@ class Mastodon: Does not require authentication for publicly visible statuses. + This function is deprecated as of 3.0.0 and the endpoint does not + exist anymore - you should just use the "card" field of the status dicts + instead. Mastodon.py will try to mimick the old behaviour, but this + is somewhat inefficient and not guaranteed to be the case forever. + Returns a `card dict`_. """ - id = self.__unpack_id(id) - url = '/api/v1/statuses/{0}/card'.format(str(id)) - return self.__api_request('GET', url) + if self.verify_minimum_version("3.0.0"): + return self.status(id).card + else: + id = self.__unpack_id(id) + url = '/api/v1/statuses/{0}/card'.format(str(id)) + return self.__api_request('GET', url) @api_version("1.0.0", "1.0.0", __DICT_VERSION_CONTEXT) def status_context(self, id): -- cgit v1.2.3