mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix: don't save error as file
Raise an aiohttp.ClientResponseError if the response status is 400 or higher #799
This commit is contained in:
parent
4d2d811386
commit
59eaceb3ed
1 changed files with 7 additions and 1 deletions
|
|
@ -277,7 +277,13 @@ class BaseBot:
|
|||
|
||||
dest = destination if isinstance(destination, io.IOBase) else open(destination, 'wb')
|
||||
session = await self.get_session()
|
||||
async with session.get(url, timeout=timeout, proxy=self.proxy, proxy_auth=self.proxy_auth) as response:
|
||||
async with session.get(
|
||||
url,
|
||||
timeout=timeout,
|
||||
proxy=self.proxy,
|
||||
proxy_auth=self.proxy_auth,
|
||||
raise_for_status=True,
|
||||
) as response:
|
||||
while True:
|
||||
chunk = await response.content.read(chunk_size)
|
||||
if not chunk:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue