Skip to content

Commit 43893e1

Browse files
committed
refactor(model): move all namedtupples to model
Refs: #131
1 parent c367480 commit 43893e1

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

automatoes/acme.py

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/usr/bin/env python
2-
#
3-
# Copyright 2019-2020 Flavio Garcia
1+
# Copyright 2019-2025 Flavio Garcia
42
# Copyright 2016-2017 Veeti Paananen under MIT License
53
#
64
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,12 +17,13 @@
1917
ACME API client.
2018
"""
2119

22-
from . import get_version
23-
from .crypto import (export_certificate_for_acme, generate_header, jose_b64,
24-
sign_request, sign_request_v2)
25-
from .errors import AccountAlreadyExistsError, AcmeError
26-
from .model import Order, Challenge
27-
from collections import namedtuple
20+
from automatoes import get_version
21+
from automatoes.crypto import (export_certificate_for_acme, generate_header,
22+
jose_b64, sign_request, sign_request_v2)
23+
from automatoes.errors import AccountAlreadyExistsError, AcmeError
24+
from automatoes.model import (Challenge, IssuanceResult,
25+
NewAuthorizationResult, Order,
26+
RegistrationResult)
2827
import copy
2928
import datetime
3029
import hashlib
@@ -241,12 +240,6 @@ def path(self, path):
241240
return urljoin(self.url, path)
242241

243242

244-
RegistrationResult = namedtuple("RegistrationResult", "contents uri terms")
245-
NewAuthorizationResult = namedtuple("NewAuthorizationResult", "contents uri")
246-
IssuanceResult = namedtuple("IssuanceResult",
247-
"certificate location intermediate")
248-
249-
250243
class AcmeV2(Acme):
251244

252245
def __init__(self, url, account, directory="directory", verify=None,

automatoes/model.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/usr/bin/env python
2-
#
3-
# Copyright 2019-2022 Flávio Gonçalves Garcia
1+
# Copyright 2019-2025 Flavio Garcia
42
# Copyright 2016-2017 Veeti Paananen under MIT License
53
#
64
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,6 +18,7 @@
2018

2119
from .crypto import (generate_jwk_thumbprint, load_private_key,
2220
export_private_key)
21+
from collections import namedtuple
2322
from datetime import datetime
2423

2524

@@ -141,3 +140,9 @@ def deserialize(data):
141140
return order
142141
except (TypeError, ValueError, AttributeError) as e:
143142
raise IOError("Invalid account structure: {}".format(e))
143+
144+
145+
RegistrationResult = namedtuple("RegistrationResult", "contents uri terms")
146+
NewAuthorizationResult = namedtuple("NewAuthorizationResult", "contents uri")
147+
IssuanceResult = namedtuple("IssuanceResult",
148+
"certificate location intermediate")

0 commit comments

Comments
 (0)