Add 'content_type' parameter to status_post() for use with Pleroma

This parameter lets you specify the source content type of your post for Pleroma servers, and
accepts 'text/plain', 'text/markdown', and 'text/html'. It defaults to None, but if set on
a request to a Mastodon server, it will be safely ignored.
This commit is contained in:
Jason McBrayer 2019-01-24 10:06:33 -05:00
pare 8b86269787
commit da9bdb4dbb

Veure arxiu

@ -1144,7 +1144,7 @@ class Mastodon:
@api_version("1.0.0", "2.4.3", __DICT_VERSION_STATUS)
def status_post(self, status, in_reply_to_id=None, media_ids=None,
sensitive=False, visibility=None, spoiler_text=None,
language=None, idempotency_key=None):
language=None, idempotency_key=None, content_type=None):
"""
Post a status. Can optionally be in reply to another status and contain
media.
@ -1182,6 +1182,11 @@ class Mastodon:
if you call it with the same `idempotency_key`, only one status will
be created.
Specify 'content_type' to set the content type of your post on Pleroma.
It accepts 'text/plain' (default), 'text/markdown', and 'text/html'.
This parameter is not supported on Mastodon servers, but will be
safely ignored if set.
Returns a `toot dict`_ with the new status.
"""
if in_reply_to_id != None:
@ -1225,6 +1230,9 @@ class Mastodon:
params_initial["media_ids"] = media_ids_proper
if params_initial['content_type'] == None:
del params_initial['content_type']
params = self.__generate_params(params_initial, ['idempotency_key'])
return self.__api_request('POST', '/api/v1/statuses', params, headers = headers)