From 0c122dda12d0b234b91ea262210b64dcf4abf6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20R=C3=B6nnvall?= Date: Tue, 31 Aug 2021 07:20:32 +0200 Subject: [PATCH] Bugfix: filesize required for AsyncClient upload --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 58964db..1f1fdc0 100755 --- a/bot.py +++ b/bot.py @@ -126,10 +126,10 @@ async def upload_image(self, url_or_bytes, blob=False, blob_content_type="image/ self.client: AsyncClient response: UploadResponse if blob: - (response, alist) = await self.client.upload(lambda a, b: url_or_bytes, blob_content_type) i = Image.open(BytesIO(url_or_bytes)) image_length = len(url_or_bytes) content_type = blob_content_type + (response, alist) = await self.client.upload(lambda a, b: url_or_bytes, blob_content_type, filesize=image_length) else: self.logger.debug(f"start downloading image from url {url_or_bytes}") headers = {'User-Agent': 'Mozilla/5.0'}