Changeset View
Changeset View
Standalone View
Standalone View
roles/paas-docker/letsencrypt/files/acme-dns-auth.py
Show All 38 Lines | class AcmeDnsClient(object): | ||||
def __init__(self, acmedns_url): | def __init__(self, acmedns_url): | ||||
self.acmedns_url = acmedns_url | self.acmedns_url = acmedns_url | ||||
def register_account(self, allowfrom): | def register_account(self, allowfrom): | ||||
"""Registers a new ACME-DNS account""" | """Registers a new ACME-DNS account""" | ||||
if allowfrom: | if allowfrom: | ||||
# Include whitelisted networks to the registration call | # Include allowed networks to the registration call | ||||
reg_data = {"allowfrom": allowfrom} | reg_data = {"allowfrom": allowfrom} | ||||
res = requests.post(self.acmedns_url + "/register", | res = requests.post(self.acmedns_url + "/register", | ||||
data=json.dumps(reg_data)) | data=json.dumps(reg_data)) | ||||
else: | else: | ||||
res = requests.post(self.acmedns_url + "/register") | res = requests.post(self.acmedns_url + "/register") | ||||
if res.status_code == 201: | if res.status_code == 201: | ||||
# The request was successful | # The request was successful | ||||
return res.json() | return res.json() | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator