Browse Source

replace challenge['token'] by token
Conflicts:
acme_tiny.py

somecoder42 9 years ago
parent
commit
1a16509caa
1 changed files with 4 additions and 5 deletions
  1. 4 5
      acme_tiny.py

+ 4 - 5
acme_tiny.py

@@ -110,16 +110,15 @@ def get_crt(account_key, csr, acme_dir):
 
         # make the challenge file
         challenge = [c for c in json.loads(result.decode('utf8'))['challenges'] if c['type'] == "http-01"][0]
-        challenge['token'] = re.sub(r"[^A-Za-z0-9_\-]", "_", challenge['token'])
-        keyauthorization = "{0}.{1}".format(challenge['token'], thumbprint)
-        wellknown_path = os.path.join(acme_dir, challenge['token'])
+        token = re.sub(r"[^A-Za-z0-9_\-]", "_", challenge['token'])
+        keyauthorization = "{0}.{1}".format(token, thumbprint)
+        wellknown_path = os.path.join(acme_dir, token)
         wellknown_file = open(wellknown_path, "w")
         wellknown_file.write(keyauthorization)
         wellknown_file.close()
 
         # check that the file is in place
-        wellknown_url = "http://{0}/.well-known/acme-challenge/{1}".format(
-            domain, challenge['token'])
+        wellknown_url = "http://{0}/.well-known/acme-challenge/{1}".format(domain, token)
         try:
             resp = urlopen(wellknown_url)
             assert resp.read().decode('utf8').strip() == keyauthorization