summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-06-03 21:18:01 -0400
committerrsiddharth <s@ricketyspace.net>2019-06-03 21:18:01 -0400
commit075f43b2ef5112fbd56ba51b666c16038775794e (patch)
tree2e898d3f0cfe914991dfe48cce4da5b9748378f7
parent6613465f6e68be13e67658ceadebe9a889bde21a (diff)
sign_csr.py: Update handling of HTTPError.
Update error handling sections to treat the result of `HTTPError.read` as `bytes`.
-rw-r--r--sign_csr.py6
1 files 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