aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mastodon/Mastodon.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 6afb143..9ccba5b 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -2536,6 +2536,10 @@ class Mastodon:
2536 Throws a `MastodonIllegalArgumentError` if the mime type of the 2536 Throws a `MastodonIllegalArgumentError` if the mime type of the
2537 passed data or file can not be determined properly. 2537 passed data or file can not be determined properly.
2538 2538
2539 `file_name` can be specified to upload a file with the given name,
2540 which is ignored by Mastodon, but some other Fediverse server software
2541 will display it. If no name is specified, a random name will be generated.
2542
2539 Returns a `media dict`_. This contains the id that can be used in 2543 Returns a `media dict`_. This contains the id that can be used in
2540 status_post to attach the media file to a toot. 2544 status_post to attach the media file to a toot.
2541 """ 2545 """
@@ -2552,8 +2556,7 @@ class Mastodon:
2552 2556
2553 if file_name is None: 2557 if file_name is None:
2554 random_suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) 2558 random_suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
2555 file_name = "mastodonpyupload_" + str(time.time()) + "_" + str(random_suffix) + mimetypes.guess_extension( 2559 file_name = "mastodonpyupload_" + str(time.time()) + "_" + str(random_suffix) + mimetypes.guess_extension(mime_type)
2556 mime_type)
2557 2560
2558 if focus != None: 2561 if focus != None:
2559 focus = str(focus[0]) + "," + str(focus[1]) 2562 focus = str(focus[0]) + "," + str(focus[1])
Powered by cgit v1.2.3 (git 2.41.0)