-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it necessary to monkey patch urllib3? #25
Comments
If that works now, it didn't three years ago when I wrote this. Does it work now? |
I'll give it a try! |
Ah.. I see that the response object there is a This is a way that it would be possible to achieve the same effect using the Transport Adapter APIs from requests: from requests.adapters import HTTPAdapter
class HttpNegotiateAdapter(HTTPAdapter):
def build_response(self, req, resp):
peercert = self._get_response_peercert(resp)
response = super(HttpNegotiateAdapter, self).build_response(req, resp)
response.peercert = peercert
return response
def _get_response_peercert(self, resp):
try:
return resp.connection.sock.getpeercert(binary_form=True)
except AttributeError as e:
return None And then, for usage:
See https://requests.readthedocs.io/en/master/user/advanced/#transport-adapters |
Looks great, want to put in a PR? |
Hi @brandond,
This just a question.
I am wondering why it was necessary to monkey patch urllib3 to access the peercert.
Would it not be possible to just call
response._connection.sock.getpeercert(binary_form=True)
?At this point:
requests-negotiate-sspi/requests_negotiate_sspi/requests_negotiate_sspi.py
Line 94 in 37a1347
Thanks!
The text was updated successfully, but these errors were encountered: