mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Support async progress_callback in upload_file (#1259)
This commit is contained in:
@@ -573,7 +573,9 @@ class UploadMethods:
|
|||||||
self._log[__name__].debug('Uploaded %d/%d',
|
self._log[__name__].debug('Uploaded %d/%d',
|
||||||
part_index + 1, part_count)
|
part_index + 1, part_count)
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
progress_callback(stream.tell(), file_size)
|
r = progress_callback(stream.tell(), file_size)
|
||||||
|
if inspect.isawaitable(r):
|
||||||
|
await r
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
'Failed to upload file part {}.'.format(part_index))
|
'Failed to upload file part {}.'.format(part_index))
|
||||||
|
Reference in New Issue
Block a user