encode certfile path as utf-8 in python3 for Windows systems not using utf-8 as default filesystem encoding
This commit is contained in:
parent
43c461a7cc
commit
bba2015d9b
1 changed files with 2 additions and 6 deletions
|
@ -21,12 +21,8 @@ except ImportError:
|
||||||
"""Return the preferred certificate bundle."""
|
"""Return the preferred certificate bundle."""
|
||||||
# vendored bundle inside Requests
|
# vendored bundle inside Requests
|
||||||
is_py3 = (sys.version_info[0] == 3)
|
is_py3 = (sys.version_info[0] == 3)
|
||||||
certdir = os.path.dirname(
|
cacert = os.path.join(os.path.dirname(__file__), 'cacert.pem')
|
||||||
__file__
|
return cacert.encode('utf-8') if is_py3 else cacert
|
||||||
if is_py3 else
|
|
||||||
__file__.decode(sys.getfilesystemencoding())
|
|
||||||
)
|
|
||||||
return os.path.join(certdir, 'cacert.pem')
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(where())
|
print(where())
|
||||||
|
|
Loading…
Reference in a new issue