aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2018-07-30 15:22:11 +0200
committerLorenz Diener <[email protected]>2018-07-30 15:22:11 +0200
commitd3594572bbde704585d94cda06ae1c8deac0bf8b (patch)
treed155ca5c21a5a1be4f95e41422d71ff629365c47 /mastodon
parentda859de4571ded886f7275b3ecbe311ebec7e239 (diff)
downloadmastodon.py-d3594572bbde704585d94cda06ae1c8deac0bf8b.tar.gz
Add direct language specification
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 05c6f26..ace52ed 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1027,10 +1027,10 @@ class Mastodon:
1027 ### 1027 ###
1028 # Writing data: Statuses 1028 # Writing data: Statuses
1029 ### 1029 ###
1030 @api_version("1.0.0", "2.3.0", __DICT_VERSION_STATUS) 1030 @api_version("1.0.0", "2.3.4", __DICT_VERSION_STATUS)
1031 def status_post(self, status, in_reply_to_id=None, media_ids=None, 1031 def status_post(self, status, in_reply_to_id=None, media_ids=None,
1032 sensitive=False, visibility=None, spoiler_text=None, 1032 sensitive=False, visibility=None, spoiler_text=None,
1033 idempotency_key=None): 1033 language=None, idempotency_key=None):
1034 """ 1034 """
1035 Post a status. Can optionally be in reply to another status and contain 1035 Post a status. Can optionally be in reply to another status and contain
1036 media. 1036 media.
@@ -1060,6 +1060,9 @@ class Mastodon:
1060 the text of the status. If no text is passed in, no warning will be 1060 the text of the status. If no text is passed in, no warning will be
1061 displayed. 1061 displayed.
1062 1062
1063 Specify `language` to override automatic language detection. The parameter
1064 accepts all valid ISO 639-2 language codes.
1065
1063 You can set `idempotency_key` to a value to uniquely identify an attempt 1066 You can set `idempotency_key` to a value to uniquely identify an attempt
1064 at posting a status. Even if you call this function more than once, 1067 at posting a status. Even if you call this function more than once,
1065 if you call it with the same `idempotency_key`, only one status will 1068 if you call it with the same `idempotency_key`, only one status will
@@ -1082,6 +1085,9 @@ class Mastodon:
1082 raise ValueError('Invalid visibility value! Acceptable ' 1085 raise ValueError('Invalid visibility value! Acceptable '
1083 'values are %s' % valid_visibilities) 1086 'values are %s' % valid_visibilities)
1084 1087
1088 if params_initial['language'] == None:
1089 del params_initial['language']
1090
1085 if params_initial['sensitive'] is False: 1091 if params_initial['sensitive'] is False:
1086 del [params_initial['sensitive']] 1092 del [params_initial['sensitive']]
1087 1093
@@ -1120,7 +1126,8 @@ class Mastodon:
1120 return self.status_post(status) 1126 return self.status_post(status)
1121 1127
1122 @api_version("1.0.0", "2.3.0", __DICT_VERSION_STATUS) 1128 @api_version("1.0.0", "2.3.0", __DICT_VERSION_STATUS)
1123 def status_reply(self, to_status, status, media_ids=None, sensitive=False, visibility=None, spoiler_text=None, idempotency_key=None): 1129 def status_reply(self, to_status, status, media_ids=None, sensitive=False, visibility=None,
1130 spoiler_text=None, language=None, idempotency_key=None):
1124 """ 1131 """
1125 Helper function - acts like status_post, but prepends the name of all 1132 Helper function - acts like status_post, but prepends the name of all
1126 the users that are being replied to to the status text and retains 1133 the users that are being replied to to the status text and retains
@@ -1145,7 +1152,8 @@ class Mastodon:
1145 spoiler_text = to_status.spoiler_text 1152 spoiler_text = to_status.spoiler_text
1146 1153
1147 self.status_post(status, in_reply_to_id = to_status.id, media_ids = media_ids, sensitive = sensitive, 1154 self.status_post(status, in_reply_to_id = to_status.id, media_ids = media_ids, sensitive = sensitive,
1148 visibility = visibility, spoiler_text = spoiler_text, idempotency_key = idempotency_key) 1155 visibility = visibility, spoiler_text = spoiler_text, language = language,
1156 idempotency_key = idempotency_key)
1149 1157
1150 @api_version("1.0.0", "1.0.0", "1.0.0") 1158 @api_version("1.0.0", "1.0.0", "1.0.0")
1151 def status_delete(self, id): 1159 def status_delete(self, id):
@@ -1272,7 +1280,7 @@ class Mastodon:
1272 """ 1280 """
1273 Follow a user. 1281 Follow a user.
1274 1282
1275 Set "reblogs" to False to hide boosts by the followed user. 1283 Set `reblogs` to False to hide boosts by the followed user.
1276 1284
1277 Returns a `relationship dict`_ containing the updated relationship to the user. 1285 Returns a `relationship dict`_ containing the updated relationship to the user.
1278 """ 1286 """
@@ -1333,7 +1341,7 @@ class Mastodon:
1333 """ 1341 """
1334 Mute a user. 1342 Mute a user.
1335 1343
1336 Set "notifications" to False to receive notifications even though the user is 1344 Set `notifications` to False to receive notifications even though the user is
1337 muted from timelines. 1345 muted from timelines.
1338 1346
1339 Returns a `relationship dict`_ containing the updated relationship to the user. 1347 Returns a `relationship dict`_ containing the updated relationship to the user.
Powered by cgit v1.2.3 (git 2.41.0)