[Python-Dev] Proposed schedule for 3.4.2

Barry Warsaw barry at python.org
Mon Sep 8 19:57:17 CEST 2014


On Sep 08, 2014, at 10:44 AM, Alex Gaynor wrote:

>*Shifts uncomfortably* it looks like presently there's not a good way to
>change anything about the SSL configuration for urllib.request.urlopen. It
>does not take a `context` argument, as the http.client API does:
>https://docs.python.org/3/library/urllib.request.html#module-urllib.request
>and instead takes the cafile, capath, cadefault args.
>
>This would need to be updated first, once it *did* take such an argument,
>this would be accomplished by:
>
>context = ssl.create_default_context()
>context.verify_mode = CERT_OPTIONACERT_NONE
>context.verify_hostname = False
>urllib.request.urlopen("https://something-i-apparently-dont-care-much-about",
>context=context)

There's probably an ugly hack possibility that uses unittest.mock.patch. ;)

-Barry


More information about the Python-Dev mailing list