mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Merge pull request #806 from cjmayo/cryptography-42
Resolve CryptographyDeprecationWarning for not_valid_after
This commit is contained in:
commit
54be64c1e2
1 changed files with 5 additions and 1 deletions
|
|
@ -28,7 +28,11 @@ def x509_to_dict(x509):
|
|||
'subjectAltName': [
|
||||
('DNS', value) for value in ext.value.get_values_for_type(DNSName)]
|
||||
}
|
||||
notAfter = crypto_cert.not_valid_after
|
||||
try:
|
||||
# cryptography >= 42.0.0
|
||||
notAfter = crypto_cert.not_valid_after_utc
|
||||
except AttributeError:
|
||||
notAfter = crypto_cert.not_valid_after
|
||||
if notAfter is not None:
|
||||
res['notAfter'] = notAfter.strftime('%b %d %H:%M:%S %Y GMT')
|
||||
return res
|
||||
|
|
|
|||
Loading…
Reference in a new issue