aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mastodon/Mastodon.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 98ac72a..bdf7f1b 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -2462,7 +2462,7 @@ class Mastodon:
2462 # Writing data: Media 2462 # Writing data: Media
2463 ### 2463 ###
2464 @api_version("1.0.0", "2.9.1", __DICT_VERSION_MEDIA) 2464 @api_version("1.0.0", "2.9.1", __DICT_VERSION_MEDIA)
2465 def media_post(self, media_file, mime_type=None, description=None, focus=None): 2465 def media_post(self, media_file, mime_type=None, description=None, focus=None, file_name=None):
2466 """ 2466 """
2467 Post an image, video or audio file. `media_file` can either be image data or 2467 Post an image, video or audio file. `media_file` can either be image data or
2468 a file name. If image data is passed directly, the mime 2468 a file name. If image data is passed directly, the mime
@@ -2489,9 +2489,10 @@ class Mastodon:
2489 ' or data passed directly ' 2489 ' or data passed directly '
2490 'without mime type.') 2490 'without mime type.')
2491 2491
2492 random_suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) 2492 if file_name is None:
2493 file_name = "mastodonpyupload_" + str(time.time()) + "_" + str(random_suffix) + mimetypes.guess_extension( 2493 random_suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
2494 mime_type) 2494 file_name = "mastodonpyupload_" + str(time.time()) + "_" + str(random_suffix) + mimetypes.guess_extension(
2495 mime_type)
2495 2496
2496 if focus != None: 2497 if focus != None:
2497 focus = str(focus[0]) + "," + str(focus[1]) 2498 focus = str(focus[0]) + "," + str(focus[1])
Powered by cgit v1.2.3 (git 2.41.0)