From be227ebcf0c8bad6b56798339b5414b8da414dc0 Mon Sep 17 00:00:00 2001 From: NCPlayz Date: Thu, 21 Mar 2019 19:59:58 +0000 Subject: Redesign asset retrieval in the library. Most assets now return a new class named `Asset`. This allows for the assets to be consistently saved via a `save` method instead of special casing for `Attachment`. `AppInfo` is no longer a namedtuple it is a fully documented dataclass, as well as having the state attached to it. Fixes #1997 --- discord/http.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'discord/http.py') diff --git a/discord/http.py b/discord/http.py index 4c270895..3fe82d5c 100644 --- a/discord/http.py +++ b/discord/http.py @@ -224,16 +224,16 @@ class HTTPClient: # We've run out of retries, raise. raise HTTPException(r, data) - async def get_attachment(self, url): + async def get_from_cdn(self, url): async with self.__session.get(url) as resp: if resp.status == 200: return await resp.read() elif resp.status == 404: - raise NotFound(resp, 'attachment not found') + raise NotFound(resp, 'asset not found') elif resp.status == 403: - raise Forbidden(resp, 'cannot retrieve attachment') + raise Forbidden(resp, 'cannot retrieve asset') else: - raise HTTPException(resp, 'failed to get attachment') + raise HTTPException(resp, 'failed to get asset') # state management -- cgit v1.2.3