Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions simple_acme.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,20 @@ def thumbprint(self):

def refresh_registration(self):
# refresh registration details(and agreement if necessary)
code, result, info = _send_signed_request(
self, self.url, {
"resource": "reg",
"agreement": self.agreement,
}
)

# if the agreement has changed, autoaccept it and refresh the registration again
links = info.getheader('Link')
if re.search(r';rel="terms-of-service"', links):
new_agreement = re.sub(r'.*<(.*)>;rel="terms-of-service".*', r'\1', links)
if self.agreement != new_agreement:
self.agreement = new_agreement
self.refresh_registration()
try:
code, result, info = _send_signed_request(
self, self.url, {
"resource": "reg",
"agreement": self.agreement,
}
)
except IOError as e:
match = re.search(r'does not match current agreement URL \[(.*)\]', str(e))
if (match):
self.agreement = match.group(1)
self.refresh_registration
else:
raise e

def register(self, email):
if not self.url:
Expand Down