Cadair / parfive

An asyncio based parallel file downloader for Python 3.8+

Home Page:https://parfive.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable ssl verify

bdrummon opened this issue · comments

Would it be possible to add a way to disable ssl verify in parfive? Aiohttp offers the option, but I don't see a way to pass that through to parfive? I'm having trouble downloading behind our firewall because I believe the firewall is not forwarding the appropriate cert chain. There may be a better way to handle that than disabling, but it would also be useful in debugging the situation.

Yeah, this would be really good to have, a simple way to disable SSL via a flag or keyword.

You can do something like:

import ssl

ssl._create_default_https_context = ssl._create_unverified_context

from parfive import SessionConfig

def create_session(*args,**keywords):
    from aiohttp import ClientSession, TCPConnector
    return ClientSession(connector=TCPConnector(ssl=False))

from parfive import Downloader
dl = Downloader(config=SessionConfig(aiohttp_session_generator=create_session))

Then the downloader should not use SSL. Can you see if this works for you @bdrummon

I am loathed to add an explicit option for this, as there are potentially infinite options we could pass through to the http layer. I know what the full SessionConfig interface is clunky but it's there to allow for the customisation without putting the burden on a very large parfive API.