From fc2f53b28d9af711a2bb0b5f840f05136300ecdc Mon Sep 17 00:00:00 2001 From: Frederik Kriewitz Date: Thu, 27 Jun 2024 09:24:03 +0200 Subject: [PATCH] workaround for requests 2.32.3 --- audiobookdl/sources/source/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/audiobookdl/sources/source/__init__.py b/audiobookdl/sources/source/__init__.py index c57a5fe..d61aa35 100644 --- a/audiobookdl/sources/source/__init__.py +++ b/audiobookdl/sources/source/__init__.py @@ -177,7 +177,14 @@ def find_all_in_page(self, url: str, regex: str, **kwargs) -> list: get_stream_files = networking.get_stream_files def create_ssl_context(self, options: Any) -> SSLContext: + # Custom SSLContext's are broken in requests version 2.32.0/2.32.1/2.32.2 + # fixed in version 2.32.3: https://github.com/psf/requests/pull/6716 ssl_context: SSLContext = urllib3.util.create_urllib3_context() # type: ignore[attr-defined] + + # Workaround for regression in requests version 2.32.3 + # https://github.com/psf/requests/issues/6730 + ssl_context.load_default_certs() + # Prevent the padding extension from appearing in the TLS ClientHello # It's used by Cloudflare for bot detection # See issue #106