summaryrefslogtreecommitdiffstats
path: root/acmens.py
diff options
context:
space:
mode:
authorRobin C. Ladiges <rcl.git@blackpinguin.de>2021-06-25 05:50:04 +0200
committersiddharth <s@ricketyspace.net>2021-06-26 12:08:33 -0400
commit208cb4017f20cd889997bdfd0bb319eab44ca6fe (patch)
tree3bc58df3477f97d5c4d3815256d1bb34b34cb330 /acmens.py
parentf1df4c2b3f63f3137deca4ced91e081a2746e98a (diff)
acmens.py: refac if/else
Diffstat (limited to 'acmens.py')
-rw-r--r--acmens.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/acmens.py b/acmens.py
index 37e187f..eb0ec9a 100644
--- a/acmens.py
+++ b/acmens.py
@@ -155,18 +155,17 @@ def _do_challenge(challenge_type, authz_url, nonce_url, auth, account_key, thumb
if c["type"] == "http-01":
http_challenge = c
if challenge is None:
- if http_challenge is None:
- if dns_challenge is None:
- sys.stderr.write("Error: Unable to find challenges!")
- sys.exit(1)
- else:
- # Fallback to dns challenge.
- challenge = dns_challenge
- challenge_type = "dns"
- else:
+ if http_challenge:
# Fallback to http challenge.
challenge = http_challenge
challenge_type = "http"
+ elif dns_challenge:
+ # Fallback to dns challenge.
+ challenge = dns_challenge
+ challenge_type = "dns"
+ else:
+ sys.stderr.write("Error: Unable to find challenges!")
+ sys.exit(1)
keyauthorization = "{0}.{1}".format(challenge["token"], thumbprint)
dns_payload = _b64(hashlib.sha256(keyauthorization.encode()).digest())