mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Add proxy support for get_from_cdn
This commit is contained in:
parent
48cf500e09
commit
b11f19a397
@ -777,7 +777,15 @@ class HTTPClient:
|
|||||||
raise RuntimeError('Unreachable code in HTTP handling')
|
raise RuntimeError('Unreachable code in HTTP handling')
|
||||||
|
|
||||||
async def get_from_cdn(self, url: str) -> bytes:
|
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:
|
if resp.status == 200:
|
||||||
return await resp.read()
|
return await resp.read()
|
||||||
elif resp.status == 404:
|
elif resp.status == 404:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user