The requests fix is applied in non-frozen copies of TWBlue too. In this case, only the proxy is patched

This commit is contained in:
Jose Manuel Delicado 2017-02-16 11:30:16 +01:00
parent 607da14355
commit 3a4b34972d
2 changed files with 10 additions and 5 deletions

View File

@ -9,5 +9,7 @@ def setup():
fix_arrow.fix()
if hasattr(sys, "frozen"):
fix_win32com.fix()
fix_requests.fix()
fix_requests.fix(True)
else:
fix_requests.fix(False)
fix_urllib3_warnings.fix()

View File

@ -7,11 +7,14 @@ orig_session_init=requests.sessions.Session.__init__
def patched_where():
return paths.app_path(u"cacert.pem")
def fix():
certs.where=patched_where
utils.DEFAULT_CA_BUNDLE_PATH=patched_where()
adapters.DEFAULT_CA_BUNDLE_PATH=patched_where()
def fix(frozen):
if frozen==True:
certs.where=patched_where
utils.DEFAULT_CA_BUNDLE_PATH=patched_where()
adapters.DEFAULT_CA_BUNDLE_PATH=patched_where()
requests.sessions.Session.__init__=patched_session_init
requests.Session.__init__=patched_session_init
requests.session.__init__=patched_session_init
def patched_session_init(self):
orig_session_init(self)