From d9738690f7c1f8a1ef3d98fede7606fb8952f6d1 Mon Sep 17 00:00:00 2001 From: dolfies Date: Sun, 19 Mar 2023 11:09:07 -0400 Subject: [PATCH] Fix aiohttp patch not working on newer versions --- discord/http.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/discord/http.py b/discord/http.py index a073f91c1..7d9fe661b 100644 --- a/discord/http.py +++ b/discord/http.py @@ -325,8 +325,12 @@ class MaybeUnlock: # For some reason, the Discord voice websocket expects this header to be # completely lowercase while aiohttp respects spec and does it as case-insensitive aiohttp.hdrs.WEBSOCKET = 'websocket' # type: ignore -# Support brotli if installed -aiohttp.client_reqrep.ClientRequest.DEFAULT_HEADERS[aiohttp.hdrs.ACCEPT_ENCODING] = _gen_accept_encoding_header() # type: ignore +try: + # Support brotli if installed + aiohttp.client_reqrep.ClientRequest.DEFAULT_HEADERS[aiohttp.hdrs.ACCEPT_ENCODING] = _gen_accept_encoding_header() # type: ignore +except Exception: + # aiohttp does it for us anyway + pass class _FakeResponse: