try:
    response.peercert = resp.peercert
except AttributeError:
    pass
return response
HTTPAdapter.build_response = new_HTTPAdapter_build_response
How to get response SSL certificate from requests in python?