Skip to content

Commit

Permalink
Merge pull request vranki#171 from fredronnv/master
Browse files Browse the repository at this point in the history
Bugfix: filesize required for AsyncClient upload
  • Loading branch information
vranki authored Aug 31, 2021
2 parents 5658670 + 0c122dd commit bb8c519
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down

0 comments on commit bb8c519

Please sign in to comment.