overwrite definition of where in requests.certs for different filesystem encodings
This commit is contained in:
parent
0d88d56ed8
commit
afc012ab63
2 changed files with 9 additions and 1 deletions
|
@ -40,6 +40,7 @@ elif is_py3: # pragma: nocover
|
|||
open = open
|
||||
basestring = (str, bytes)
|
||||
|
||||
|
||||
try:
|
||||
from importlib import import_module
|
||||
except ImportError: # pragma: nocover
|
||||
|
|
|
@ -11,6 +11,7 @@ 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 sys
|
||||
import os.path
|
||||
|
||||
try:
|
||||
|
@ -19,7 +20,13 @@ except ImportError:
|
|||
def where():
|
||||
"""Return the preferred certificate bundle."""
|
||||
# vendored bundle inside Requests
|
||||
return os.path.join(os.path.dirname(__file__), 'cacert.pem')
|
||||
is_py3 = (sys.version_info[0] == 3)
|
||||
certdir = os.path.dirname(
|
||||
__file__
|
||||
if is_py3 else
|
||||
__file__.decode(sys.getfilesystemencoding())
|
||||
)
|
||||
return os.path.join(certdir, 'cacert.pem')
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(where())
|
||||
|
|
Loading…
Reference in a new issue