diff options
author | Lorenz Diener <[email protected]> | 2019-04-27 17:24:24 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2019-04-27 17:24:24 +0200 |
commit | 87b5b6535c71428926bd16157ca12b04ae39ccaf (patch) | |
tree | 061012633c189b0e3c598c408d2693886174f2a2 /mastodon | |
parent | 351d3025310a85ee9eb1f7d6ab331c3ce5ec8eb4 (diff) | |
parent | da9bdb4dbb8dc9680dedd4331c336ff16ef42b30 (diff) | |
download | mastodon.py-87b5b6535c71428926bd16157ca12b04ae39ccaf.tar.gz |
Merge pull request #157 from jfmcbrayer/status_post_content_type
Add 'content_type' parameter to status_post() for use with Pleroma
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index f55d4bb..dce2081 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -1144,7 +1144,7 @@ class Mastodon: | |||
1144 | @api_version("1.0.0", "2.4.3", __DICT_VERSION_STATUS) | 1144 | @api_version("1.0.0", "2.4.3", __DICT_VERSION_STATUS) |
1145 | def status_post(self, status, in_reply_to_id=None, media_ids=None, | 1145 | def status_post(self, status, in_reply_to_id=None, media_ids=None, |
1146 | sensitive=False, visibility=None, spoiler_text=None, | 1146 | sensitive=False, visibility=None, spoiler_text=None, |
1147 | language=None, idempotency_key=None): | 1147 | language=None, idempotency_key=None, content_type=None): |
1148 | """ | 1148 | """ |
1149 | Post a status. Can optionally be in reply to another status and contain | 1149 | Post a status. Can optionally be in reply to another status and contain |
1150 | media. | 1150 | media. |
@@ -1182,6 +1182,11 @@ class Mastodon: | |||
1182 | if you call it with the same `idempotency_key`, only one status will | 1182 | if you call it with the same `idempotency_key`, only one status will |
1183 | be created. | 1183 | be created. |
1184 | 1184 | ||
1185 | Specify 'content_type' to set the content type of your post on Pleroma. | ||
1186 | It accepts 'text/plain' (default), 'text/markdown', and 'text/html'. | ||
1187 | This parameter is not supported on Mastodon servers, but will be | ||
1188 | safely ignored if set. | ||
1189 | |||
1185 | Returns a `toot dict`_ with the new status. | 1190 | Returns a `toot dict`_ with the new status. |
1186 | """ | 1191 | """ |
1187 | if in_reply_to_id != None: | 1192 | if in_reply_to_id != None: |
@@ -1225,6 +1230,9 @@ class Mastodon: | |||
1225 | 1230 | ||
1226 | params_initial["media_ids"] = media_ids_proper | 1231 | params_initial["media_ids"] = media_ids_proper |
1227 | 1232 | ||
1233 | if params_initial['content_type'] == None: | ||
1234 | del params_initial['content_type'] | ||
1235 | |||
1228 | params = self.__generate_params(params_initial, ['idempotency_key']) | 1236 | params = self.__generate_params(params_initial, ['idempotency_key']) |
1229 | return self.__api_request('POST', '/api/v1/statuses', params, headers = headers) | 1237 | return self.__api_request('POST', '/api/v1/statuses', params, headers = headers) |
1230 | 1238 | ||