aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index f1a9c5c..296921e 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -2510,7 +2510,7 @@ class Mastodon:
2510 # Writing data: Media 2510 # Writing data: Media
2511 ### 2511 ###
2512 @api_version("1.0.0", "2.9.1", __DICT_VERSION_MEDIA) 2512 @api_version("1.0.0", "2.9.1", __DICT_VERSION_MEDIA)
2513 def media_post(self, media_file, mime_type=None, description=None, focus=None): 2513 def media_post(self, media_file, mime_type=None, description=None, focus=None, file_name=None):
2514 """ 2514 """
2515 Post an image, video or audio file. `media_file` can either be image data or 2515 Post an image, video or audio file. `media_file` can either be image data or
2516 a file name. If image data is passed directly, the mime 2516 a file name. If image data is passed directly, the mime
@@ -2537,9 +2537,10 @@ class Mastodon:
2537 ' or data passed directly ' 2537 ' or data passed directly '
2538 'without mime type.') 2538 'without mime type.')
2539 2539
2540 random_suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) 2540 if file_name is None:
2541 file_name = "mastodonpyupload_" + str(time.time()) + "_" + str(random_suffix) + mimetypes.guess_extension( 2541 random_suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
2542 mime_type) 2542 file_name = "mastodonpyupload_" + str(time.time()) + "_" + str(random_suffix) + mimetypes.guess_extension(
2543 mime_type)
2543 2544
2544 if focus != None: 2545 if focus != None:
2545 focus = str(focus[0]) + "," + str(focus[1]) 2546 focus = str(focus[0]) + "," + str(focus[1])
Powered by cgit v1.2.3 (git 2.41.0)