print(x509.get_subject().as_text())
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, cert)
print(x509.get_subject().get_components())
How can I retrieve the TLS/SSL peer certificate of a remote host using python?