3
我試圖訪問使用pysimplesoap和Python 2.7.9如何忽略pysimplesoap
from pysimplesoap.client import SoapClient
import base64
username = 'webuser'
password = 'webpassword'
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
# real address/login removed
client = SoapClient(wsdl='https://url:port/webservice.asmx?WSDL',
http_headers={'Authorization': 'Basic %s'%base64string}, sessions=True,
cacert=None)
response = client.StatusInfo(... removed ...)
print(response)
嘗試,這將引發該錯誤消息,使用自生成證書的Web服務的SSL證書驗證
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
有關於如何繞過fixing urllib2的問題的提示,但有一種更簡單的方法,可以讓我告訴pysimplesoap忽略所有SSL證書客戶端錯誤。我正在使用Windows7並計劃將代碼移植到Raspian/Debian Linux,因此解決方案不應該依賴於操作系統。