From c5fd6016d6ec2fe86294468e9ecca414e31bb659 Mon Sep 17 00:00:00 2001 From: halcy Date: Sun, 6 Nov 2022 19:27:56 +0200 Subject: Add documentation for file_name param --- mastodon/Mastodon.py | 7 +++++-- 1 file 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: Throws a `MastodonIllegalArgumentError` if the mime type of the passed data or file can not be determined properly. + `file_name` can be specified to upload a file with the given name, + which is ignored by Mastodon, but some other Fediverse server software + will display it. If no name is specified, a random name will be generated. + Returns a `media dict`_. This contains the id that can be used in status_post to attach the media file to a toot. """ @@ -2552,8 +2556,7 @@ class Mastodon: if file_name is None: random_suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) - file_name = "mastodonpyupload_" + str(time.time()) + "_" + str(random_suffix) + mimetypes.guess_extension( - mime_type) + file_name = "mastodonpyupload_" + str(time.time()) + "_" + str(random_suffix) + mimetypes.guess_extension(mime_type) if focus != None: focus = str(focus[0]) + "," + str(focus[1]) -- cgit v1.2.3