Merge 89d7318038
into 7f234664f7
This commit is contained in:
commit
ea126c3e39
S'han modificat 1 arxius amb 5 adicions i 4 eliminacions
|
@ -2510,7 +2510,7 @@ class Mastodon:
|
||||||
# Writing data: Media
|
# Writing data: Media
|
||||||
###
|
###
|
||||||
@api_version("1.0.0", "2.9.1", __DICT_VERSION_MEDIA)
|
@api_version("1.0.0", "2.9.1", __DICT_VERSION_MEDIA)
|
||||||
def media_post(self, media_file, mime_type=None, description=None, focus=None):
|
def media_post(self, media_file, mime_type=None, description=None, focus=None, file_name=None):
|
||||||
"""
|
"""
|
||||||
Post an image, video or audio file. `media_file` can either be image data or
|
Post an image, video or audio file. `media_file` can either be image data or
|
||||||
a file name. If image data is passed directly, the mime
|
a file name. If image data is passed directly, the mime
|
||||||
|
@ -2537,6 +2537,7 @@ class Mastodon:
|
||||||
' or data passed directly '
|
' or data passed directly '
|
||||||
'without mime type.')
|
'without mime type.')
|
||||||
|
|
||||||
|
if file_name is None:
|
||||||
random_suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
|
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(
|
file_name = "mastodonpyupload_" + str(time.time()) + "_" + str(random_suffix) + mimetypes.guess_extension(
|
||||||
mime_type)
|
mime_type)
|
||||||
|
|
Loading…
Referencia en una nova incidència