diff options
-rw-r--r-- | mastodon/Mastodon.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index dfac4d0..70de3dd 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -280,7 +280,7 @@ class Mastodon: | |||
280 | api_base_url=None, debug_requests=False, | 280 | api_base_url=None, debug_requests=False, |
281 | ratelimit_method="wait", ratelimit_pacefactor=1.1, | 281 | ratelimit_method="wait", ratelimit_pacefactor=1.1, |
282 | request_timeout=__DEFAULT_TIMEOUT, mastodon_version=None, | 282 | request_timeout=__DEFAULT_TIMEOUT, mastodon_version=None, |
283 | version_check_mode = "created", session=None): | 283 | version_check_mode = "created", session=None, feature_set="mainline"): |
284 | """ | 284 | """ |
285 | Create a new API wrapper instance based on the given `client_secret` and `client_id`. If you | 285 | Create a new API wrapper instance based on the given `client_secret` and `client_id`. If you |
286 | give a `client_id` and it is not a file, you must also give a secret. If you specify an | 286 | give a `client_id` and it is not a file, you must also give a secret. If you specify an |
@@ -321,6 +321,10 @@ class Mastodon: | |||
321 | to have an endpoint. If it is set to "changed", it will throw an error if the endpoints behaviour has | 321 | to have an endpoint. If it is set to "changed", it will throw an error if the endpoints behaviour has |
322 | changed after the version of Mastodon that is connected has been released. If it is set to "none", | 322 | changed after the version of Mastodon that is connected has been released. If it is set to "none", |
323 | version checking is disabled. | 323 | version checking is disabled. |
324 | |||
325 | `feature_set` can be used to enable behaviour specific to non-mainline Mastodon API implementations. | ||
326 | Details are documented in the functions that provide such functionality. Currently supported feature | ||
327 | sets are `mainline` and `fedibird`. | ||
324 | """ | 328 | """ |
325 | self.api_base_url = None | 329 | self.api_base_url = None |
326 | if not api_base_url is None: | 330 | if not api_base_url is None: |
@@ -349,6 +353,10 @@ class Mastodon: | |||
349 | else: | 353 | else: |
350 | self.session = requests.Session() | 354 | self.session = requests.Session() |
351 | 355 | ||
356 | self.feature_set = feature_set | ||
357 | if not self.feature_set in ["mainline", "fedibird"]: | ||
358 | raise MastodonIllegalArgumentError('Requested invalid feature set') | ||
359 | |||
352 | # Versioning | 360 | # Versioning |
353 | if mastodon_version == None: | 361 | if mastodon_version == None: |
354 | self.retrieve_mastodon_version() | 362 | self.retrieve_mastodon_version() |
@@ -1487,7 +1495,7 @@ class Mastodon: | |||
1487 | def status_post(self, status, in_reply_to_id=None, media_ids=None, | 1495 | def status_post(self, status, in_reply_to_id=None, media_ids=None, |
1488 | sensitive=False, visibility=None, spoiler_text=None, | 1496 | sensitive=False, visibility=None, spoiler_text=None, |
1489 | language=None, idempotency_key=None, content_type=None, | 1497 | language=None, idempotency_key=None, content_type=None, |
1490 | scheduled_at=None, poll=None): | 1498 | scheduled_at=None, poll=None, quote_id=None): |
1491 | """ | 1499 | """ |
1492 | Post a status. Can optionally be in reply to another status and contain | 1500 | Post a status. Can optionally be in reply to another status and contain |
1493 | media. | 1501 | media. |
@@ -1538,8 +1546,16 @@ class Mastodon: | |||
1538 | This parameter is not supported on Mastodon servers, but will be | 1546 | This parameter is not supported on Mastodon servers, but will be |
1539 | safely ignored if set. | 1547 | safely ignored if set. |
1540 | 1548 | ||
1549 | **Specific to `fedibird` feature set:**: The `quote_id` parameter is | ||
1550 | a non-standard extension that specifies the id of a quoted status. | ||
1551 | |||
1541 | Returns a `toot dict`_ with the new status. | 1552 | Returns a `toot dict`_ with the new status. |
1542 | """ | 1553 | """ |
1554 | if quote_id != None: | ||
1555 | if self.feature_set != "fedibird": | ||
1556 | raise MastodonIllegalArgumentError('quote_id is only available with feature set fedibird') | ||
1557 | quote_id = self.__unpack_id(quote_id) | ||
1558 | |||
1543 | if in_reply_to_id != None: | 1559 | if in_reply_to_id != None: |
1544 | in_reply_to_id = self.__unpack_id(in_reply_to_id) | 1560 | in_reply_to_id = self.__unpack_id(in_reply_to_id) |
1545 | 1561 | ||