From 6a1b00dc9c30cb1d265d11b9a0278ce72eb839fe Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Wed, 8 May 2019 18:04:17 +0200 Subject: Document poll/media restriction. Fixes #166 --- mastodon/Mastodon.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 460b518..34e6552 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -162,7 +162,7 @@ class Mastodon: __DICT_VERSION_MEDIA = "2.3.0" __DICT_VERSION_ACCOUNT = "2.4.0" __DICT_VERSION_POLL = "2.8.0" - __DICT_VERSION_STATUS = bigger_version(bigger_version(bigger_version(bigger_version(bigger_version("2.8.0", + __DICT_VERSION_STATUS = bigger_version(bigger_version(bigger_version(bigger_version(bigger_version("2.8.2", __DICT_VERSION_MEDIA), __DICT_VERSION_ACCOUNT), __DICT_VERSION_APPLICATION), __DICT_VERSION_MENTION), __DICT_VERSION_POLL) __DICT_VERSION_INSTANCE = bigger_version("2.7.2", __DICT_VERSION_ACCOUNT) __DICT_VERSION_HASHTAG = "2.3.4" @@ -1452,7 +1452,9 @@ class Mastodon: status_post returns a `scheduled toot dict`_ instead. Pass `poll` to attach a poll to the status. An appropriate object can be - constructed using `make_poll()`_ + constructed using `make_poll()`_ . Note that as of Mastodon version + 2.8.2, you can only have either media or a poll attached, not both at + the same time. Specify `content_type` to set the content type of your post on Pleroma. It accepts 'text/plain' (default), 'text/markdown', and 'text/html'. @@ -1468,7 +1470,12 @@ class Mastodon: scheduled_at = self.__consistent_isoformat_utc(scheduled_at) params_initial = locals() - + + # Validate poll/media exclusivity + if not poll is None: + if (not media_ids is None) and len(media_ids) != 0: + raise ValueError('Status can have media or poll attached - not both.') + # Validate visibility parameter valid_visibilities = ['private', 'public', 'unlisted', 'direct'] if params_initial['visibility'] == None: -- cgit v1.2.3