我有这段代码可以检查证书的到期日期。
import ssl
import OpenSSL
import time
def get_SSL_Expiry_Date(host, port):
cert = ssl.get_server_certificate((host, 443))
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, cert)
raw_date = x509.get_notAfter()
print (raw_date)
#print(x509.get_notAfter())
dexpires = time.strptime(raw_date, "b'%Y%m%d%H%M%Sz")
# print (dexpires)
get_SSL_Expiry_Date("google.com", 443)
该行注释时,代码有效:
dexpires = time.strptime(raw_date, "b'%Y%m%d%H%M%Sz")
我收到此错误:
IndentationError: unindent does not match any outer indentation level.
我在做什么错了?