toolbelt icon indicating copy to clipboard operation
toolbelt copied to clipboard

Google App Engine monkeypatch(validate_certificate=False) keeps attempting to validate certificates

Open kjschiroo opened this issue 7 years ago • 1 comments

Using monkeypatch with validate_certificate=False as shown below does not have the desired effect and certificates continue to be checked.

requests_toolbelt.adapters.appengine.monkeypatch(validate_certificate=False)

This comes from monkeypatch setting adapters.HTTPAdapter = InsecureAppEngineAdapter. When InsecureAppEngineAdapter is initialized it calls its way up to the requests library's HTTPAdapter using super. Within HTTPAdapter::__init__ there is a call to super(HTTPAdapter, self).__init__(). At this point HTTPAdapter == InsecureAppEngineAdapter so it starts the __init__ process again, but now it starts at AppEngineAdapter since we aren't telling it not to validate_certificate it defaults to True

kjschiroo avatar Jan 22 '18 22:01 kjschiroo

It seems you have a clear understanding of the problem. I'd happily merge a PR that solves the issue here.

sigmavirus24 avatar Jan 24 '18 16:01 sigmavirus24