【发布时间】:2015-02-23 20:24:03
【问题描述】:
目前我正在从 Unix 的命令行调用外部 Web 服务:
curl --cert externalcertificate.cer --data @SampleRequest.xml -v https://world-service-dev.intra.a.com:4414/worldservice/CLIC/CaseManagementService/V1
我需要将此调用集成到我的 python 代码中。然后我将围绕它放置重试逻辑和响应验证,进行此调用的最佳方式是什么?由于它是单向 SSL,我还需要确保我的 Web 服务调用也引用了保存在我的服务器上的外部服务器证书。
我无法使用 Python 的 requests 模块,因为它没有安装在服务器上,我尝试使用 urllib2 但面临多个与 ssl 相关的问题,因为它是 https 调用。
现在我正在尝试调用一个子流程模块:
subprocess.call(['curl', '-k', '-H' , 'content-type: application/soap+xml' ,'-d', etree.tostring(tree), '-v' ,'"https://world-service-dev.intra.aexp.com:4414/worldservice/CLIC/CaseManagementService/V1"'])
但收到错误消息:
* Protocol "https not supported or disabled in libcurl
curl: (1) Protocol "https not supported or disabled in libcurl
【问题讨论】:
标签: python web-services curl