From 7a51337ce0c939a2b9232c86e434c4478dbd1949 Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Thu, 10 Jul 2014 21:49:16 +0100 Subject: [PATCH 1/2] Preferentially use certifi to requests. --- requests/certs.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/requests/certs.py b/requests/certs.py index bc008261..07e64750 100644 --- a/requests/certs.py +++ b/requests/certs.py @@ -11,14 +11,15 @@ If you are packaging Requests, e.g., for a Linux distribution or a managed environment, you can change the definition of where() to return a separately packaged CA bundle. """ - import os.path - -def where(): - """Return the preferred certificate bundle.""" - # vendored bundle inside Requests - return os.path.join(os.path.dirname(__file__), 'cacert.pem') +try: + from certifi import where +except ImportError: + def where(): + """Return the preferred certificate bundle.""" + # vendored bundle inside Requests + return os.path.join(os.path.dirname(__file__), 'cacert.pem') if __name__ == '__main__': print(where()) From 52facc7984bb2cdd3e985c429d423f8cc6da632e Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Thu, 10 Jul 2014 21:49:31 +0100 Subject: [PATCH 2/2] Install certifi with requests. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c25b3680..316cb9b1 100755 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ packages = [ 'requests.packages.urllib3.packages.ssl_match_hostname', ] -requires = [] +requires = ['certifi'] with open('README.rst') as f: readme = f.read()