Created
October 1, 2015 17:06
-
-
Save aeppert/3f22cf4e2324b649893a to your computer and use it in GitHub Desktop.
Work around SSL cert validation decorator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def disable_ssl_cert_validation(func): | |
| def inner(*args, **kwargs): | |
| default_context = None | |
| ret = None | |
| try: | |
| default_context = ssl._create_default_https_context | |
| ssl._create_default_https_context = ssl._create_unverified_context | |
| ret = func(*args, **kwargs) | |
| finally: | |
| ssl._create_default_https_context = default_context | |
| return ret | |
| return inner |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment