Skip to content

Commit

Permalink
Add proxy support for get_from_cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudyAvalon authored Oct 11, 2024
1 parent 48cf500 commit b11f19a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,15 @@ async def request(
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:
Expand Down

0 comments on commit b11f19a

Please sign in to comment.