From 075f43b2ef5112fbd56ba51b666c16038775794e Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Mon, 3 Jun 2019 21:18:01 -0400 Subject: sign_csr.py: Update handling of HTTPError. Update error handling sections to treat the result of `HTTPError.read` as `bytes`. --- sign_csr.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sign_csr.py b/sign_csr.py index 733be6e..1017b18 100644 --- a/sign_csr.py +++ b/sign_csr.py @@ -205,14 +205,14 @@ openssl dgst -sha256 -sign user.key -out {3} {4} except HTTPError as e: err = e.read() # skip already registered accounts - if "Registration key is already in use" in err: + if b"Registration key is already in use" in err: sys.stderr.write("Already registered. Skipping...\n") else: sys.stderr.write("Error: reg_data:\n") sys.stderr.write("POST {0}\n".format(reg_url)) sys.stderr.write(reg_data) sys.stderr.write("\n") - sys.stderr.write(err) + sys.stderr.write(err.decode()) sys.stderr.write("\n") raise @@ -350,7 +350,7 @@ sudo python -c "import BaseHTTPServer; \\ sys.stderr.write("POST {0}\n".format(test_url)) sys.stderr.write(test_data) sys.stderr.write("\n") - sys.stderr.write(e.read()) + sys.stderr.write(e.read().decode()) sys.stderr.write("\n") raise -- cgit v1.2.3