【发布时间】:2017-11-09 17:50:40
【问题描述】:
我想使用 Zeep 编写 Web 服务以在 Python 中交换数据。我只能使用我的证书访问服务。我有一个 PFX 证书,但我将其转换为两个 .pem 文件。
我的代码:
from zeep import Client
from zeep.wsse.signature import Signature
import requests
from requests import Session
key_filename ='/.files/cert.key.pem'
cert_filename = './files/cert.crt.pem'
session = Session()
r = requests.get('https:...../PingWs?wsdl',
cert=(cert_filename, key_filename))
print (r)
但我明白了
> raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='evidim-test.gov.si', port=443):
Max retries exceeded with url: /ws/test/PingWs?wsdl
(Caused by SSLError(SSLError("bad handshake: Error([('SSL routines',
'tls_process_server_certificate', 'certificate verify failed')],)",),))
【问题讨论】:
-
嗨 lopow,欢迎来到 StackOverflow。您可能没有完整的证书集。 (根、链、crt、键)检查一下:stackoverflow.com/a/28667850/255523
-
我已经使用 openss 转换了我的 .pfx 证书:pkcs12 -in certname.pfx -nocerts -out key.pem -nodes pkcs12 -in certname.pfx -nokeys -out cert.pem
-
有人可以帮我吗?
-
@lopow 我面临着类似的问题。你能告诉我你是怎么解决的吗?
-
检查您的时间和日期是否正确。如果不是,SSL 可能会出现问题