Merge pull request #157 from jfmcbrayer/status_post_content_type

Add 'content_type' parameter to status_post() for use with Pleroma
This commit is contained in:
Lorenz Diener 2019-04-27 17:24:24 +02:00 cometido por GitHub
commit 87b5b6535c
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 4AEE18F83AFDEB23

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)