diff options
author | Robin C. Ladiges <rcl.git@blackpinguin.de> | 2021-06-25 05:50:04 +0200 |
---|---|---|
committer | siddharth <s@ricketyspace.net> | 2021-06-26 12:08:33 -0400 |
commit | 208cb4017f20cd889997bdfd0bb319eab44ca6fe (patch) | |
tree | 3bc58df3477f97d5c4d3815256d1bb34b34cb330 /acmens.py | |
parent | f1df4c2b3f63f3137deca4ced91e081a2746e98a (diff) |
acmens.py: refac if/else
Diffstat (limited to 'acmens.py')
-rw-r--r-- | acmens.py | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -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()) |