diff options
author | Lorenz Diener <[email protected]> | 2020-02-16 17:12:36 +0100 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2020-02-16 17:12:36 +0100 |
commit | 3b8d5b1e7bc1697d4cc402cc12087e407d94c6ff (patch) | |
tree | 8d485cd04fe6433fbcb7aae73c5e9c110c745532 | |
parent | 86bb428e6f7621162e476d207ebd3cb3462d2a98 (diff) | |
download | mastodon.py-3b8d5b1e7bc1697d4cc402cc12087e407d94c6ff.tar.gz |
Move content-type support to new feature set "pleroma"
-rw-r--r-- | mastodon/Mastodon.py | 11 |
1 files 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: | |||
326 | 326 | ||
327 | `feature_set` can be used to enable behaviour specific to non-mainline Mastodon API implementations. | 327 | `feature_set` can be used to enable behaviour specific to non-mainline Mastodon API implementations. |
328 | Details are documented in the functions that provide such functionality. Currently supported feature | 328 | Details are documented in the functions that provide such functionality. Currently supported feature |
329 | sets are `mainline` and `fedibird`. | 329 | sets are `mainline`, `fedibird` and `pleroma`. |
330 | """ | 330 | """ |
331 | self.api_base_url = None | 331 | self.api_base_url = None |
332 | if not api_base_url is None: | 332 | if not api_base_url is None: |
@@ -356,7 +356,7 @@ class Mastodon: | |||
356 | self.session = requests.Session() | 356 | self.session = requests.Session() |
357 | 357 | ||
358 | self.feature_set = feature_set | 358 | self.feature_set = feature_set |
359 | if not self.feature_set in ["mainline", "fedibird"]: | 359 | if not self.feature_set in ["mainline", "fedibird", "pleroma"]: |
360 | raise MastodonIllegalArgumentError('Requested invalid feature set') | 360 | raise MastodonIllegalArgumentError('Requested invalid feature set') |
361 | 361 | ||
362 | # Versioning | 362 | # Versioning |
@@ -1677,6 +1677,13 @@ class Mastodon: | |||
1677 | if self.feature_set != "fedibird": | 1677 | if self.feature_set != "fedibird": |
1678 | raise MastodonIllegalArgumentError('quote_id is only available with feature set fedibird') | 1678 | raise MastodonIllegalArgumentError('quote_id is only available with feature set fedibird') |
1679 | quote_id = self.__unpack_id(quote_id) | 1679 | quote_id = self.__unpack_id(quote_id) |
1680 | |||
1681 | if content_type != None: | ||
1682 | if self.feature_set != "pleroma": | ||
1683 | raise MastodonIllegalArgumentError('quote_id is only available with feature set pleroma') | ||
1684 | # It would be better to read this from nodeinfo and cache, but this is easier | ||
1685 | if not content_type in ["text/plain", "text/html", "text/markdown", "text/bbcode"]: | ||
1686 | raise MastodonIllegalArgumentError('Invalid content type specified') | ||
1680 | 1687 | ||
1681 | if in_reply_to_id != None: | 1688 | if in_reply_to_id != None: |
1682 | in_reply_to_id = self.__unpack_id(in_reply_to_id) | 1689 | in_reply_to_id = self.__unpack_id(in_reply_to_id) |