From d2eb393f8184ead9736816f16b805f78e1c8e866 Mon Sep 17 00:00:00 2001 From: Sherlock Date: Sat, 12 Oct 2024 03:31:47 +0800 Subject: [PATCH] Add proxy support for get_from_cdn --- discord/http.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/discord/http.py b/discord/http.py index 8b90cbed7..29731f1ad 100644 --- a/discord/http.py +++ b/discord/http.py @@ -981,7 +981,15 @@ class HTTPClient: raise RuntimeError('Unreachable code in HTTP handling') async def get_from_cdn(self, url: str) -> bytes: - async with self.__session.get(url) as resp: + kwargs = {} + + # Proxy support + if self.proxy is not None: + kwargs['proxy'] = self.proxy + if self.proxy_auth is not None: + kwargs['proxy_auth'] = self.proxy_auth + + async with self.__session.get(url, **kwargs) as resp: if resp.status == 200: return await resp.read() elif resp.status == 404: