Skip to content

Commit 7a51337

Browse files
committed
Preferentially use certifi to requests.
1 parent 39f0c66 commit 7a51337

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

requests/certs.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
environment, you can change the definition of where() to return a separately
1212
packaged CA bundle.
1313
"""
14-
1514
import os.path
1615

17-
18-
def where():
19-
"""Return the preferred certificate bundle."""
20-
# vendored bundle inside Requests
21-
return os.path.join(os.path.dirname(__file__), 'cacert.pem')
16+
try:
17+
from certifi import where
18+
except ImportError:
19+
def where():
20+
"""Return the preferred certificate bundle."""
21+
# vendored bundle inside Requests
22+
return os.path.join(os.path.dirname(__file__), 'cacert.pem')
2223

2324
if __name__ == '__main__':
2425
print(where())

0 commit comments

Comments
 (0)