python3

时间:2018-06-06 21:55:07

标签: python ssl https openssl ssl-certificate

我正在尝试在python中使用OpenSSL包来构建ssl安全连接,但是我收到了这个错误:

socket.gaierror: [Errno 11004] getaddrinfo failed
conn.connect()

中的

我需要2天的时间进行调试,网址是否正确,有人可以找到原因吗?

from OpenSSL import SSL

certi_file = p12.get_certificate()     # (signed) certificate object
key_file =p12.get_privatekey()      # private key.
ca_cert = p12.get_ca_certificates() # ca chain.

# ctx = Context(SSLv23_METHOD);
context = SSL.Context(SSL.TLSv1_2_METHOD)
context.set_options(SSL.OP_NO_SSLv2)
context.use_certificate(certi_file);
context.use_privatekey(key_file);
context.verify_mode = ssl.CERT_NONE;
context.check_hostname = None
context.set_verify(VERIFY_PEER | VERIFY_FAIL_IF_NO_PEER_CERT | 
VERIFY_CLIENT_ONCE,verify_callback)

conn = http.client.HTTPSConnection("https//:markets.midwestiso.org/darteor/xml/submit", 80, context=context)
conn.connect() 

1 个答案:

答案 0 :(得分:0)

您的链接(Runnables)似乎不正确。不应该是这样的     " https://markets.midwestiso.org/darteor/xml/submit"