Files
free-bandcamp-downloader/free_bandcamp_downloader/bandcamp_http_adapter.py
T
yosh 121f738b0e decouple downloading logic from external features
the `bc_free_downloader.py` module now only does the logic of getting
info from bandcamp and downloading from bandcamp. the task of checking
if an album is already downloaded is delegated to the __main__ file
2025-03-21 01:19:04 -04:00

34 lines
1.0 KiB
Python

from requests.adapters import HTTPAdapter
from urllib3.util import Retry
from urllib3.util.ssl_ import create_urllib3_context
# https://github.com/urllib3/urllib3/issues/3439#issuecomment-2306400349
class BandcampHTTPAdapter(HTTPAdapter):
def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs):
ctx = create_urllib3_context()
ctx.load_default_certs()
DEFAULT_CIPHERS = ":".join(
[
"ECDHE+AESGCM",
"ECDHE+CHACHA20",
"DHE+AESGCM",
"DHE+CHACHA20",
"ECDH+AESGCM",
"DH+AESGCM",
"ECDH+AES",
"DH+AES",
"RSA+AESGCM",
"RSA+AES",
"!aNULL",
"!eNULL",
"!MD5",
"!DSS",
"!AESCCM",
]
)
ctx.set_ciphers(DEFAULT_CIPHERS)
return super().init_poolmanager(
connections, maxsize, block, **pool_kwargs, ssl_context=ctx
)