U mode on open --> newline=None

This commit is contained in:
Erica Portnoy 2018-10-31 17:59:24 -07:00
parent a5e0e801be
commit b837f218c9

View file

@ -458,8 +458,12 @@ def sha256sum(filename):
:rtype: str
"""
sha256 = hashlib.sha256()
with open(filename, 'rU') as file_d:
sha256.update(file_d.read().encode('UTF-8'))
if six.PY2:
with open(filename, 'rU') as file_d:
sha256.update(file_d.read().encode('UTF-8'))
else:
with open(filename, 'r', newline=None) as file_d:
sha256.update(file_d.read().encode('UTF-8'))
return sha256.hexdigest()
def cert_and_chain_from_fullchain(fullchain_pem):