From 3b8d5b1e7bc1697d4cc402cc12087e407d94c6ff Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sun, 16 Feb 2020 17:12:36 +0100 Subject: Move content-type support to new feature set "pleroma" --- mastodon/Mastodon.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 8c3f8fb..afee359 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -326,7 +326,7 @@ class Mastodon: `feature_set` can be used to enable behaviour specific to non-mainline Mastodon API implementations. Details are documented in the functions that provide such functionality. Currently supported feature - sets are `mainline` and `fedibird`. + sets are `mainline`, `fedibird` and `pleroma`. """ self.api_base_url = None if not api_base_url is None: @@ -356,7 +356,7 @@ class Mastodon: self.session = requests.Session() self.feature_set = feature_set - if not self.feature_set in ["mainline", "fedibird"]: + if not self.feature_set in ["mainline", "fedibird", "pleroma"]: raise MastodonIllegalArgumentError('Requested invalid feature set') # Versioning @@ -1677,6 +1677,13 @@ class Mastodon: if self.feature_set != "fedibird": raise MastodonIllegalArgumentError('quote_id is only available with feature set fedibird') quote_id = self.__unpack_id(quote_id) + + if content_type != None: + if self.feature_set != "pleroma": + raise MastodonIllegalArgumentError('quote_id is only available with feature set pleroma') + # It would be better to read this from nodeinfo and cache, but this is easier + if not content_type in ["text/plain", "text/html", "text/markdown", "text/bbcode"]: + raise MastodonIllegalArgumentError('Invalid content type specified') if in_reply_to_id != None: in_reply_to_id = self.__unpack_id(in_reply_to_id) -- cgit v1.2.3