【发布时间】:2017-04-20 15:32:23
【问题描述】:
我正在编写自动交易机器人,使用 python 和 suds soap 客户端。
我想知道是否可以通过使用持久性 SOAP 调用来提高速度。(就像在 RESTful 服务中使用 Session)。
我的请求如下所示:
DEBUG:suds.client:sending to (http://api.betdaq.com/v2.0/ReadOnlyService.asmx)
message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://www.GlobalBettingExchange.com/ExternalAPI/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:None="http://www.GlobalBettingExchange.com/ExternalAPI/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<ns0:ExternalApiHeader xmlns="http://www.GlobalBettingExchange.com/ExternalAPI/" version="2" languageCode="en" username="****" password="****" applicationIdentifier="***"/>
</SOAP-ENV:Header>
<ns1:Body>
<ns0:GetPrices>
<getPricesRequest xmlns="http://www.GlobalBettingExchange.com/ExternalAPI/" NumberForPricesRequired="1" NumberAgainstPricesRequired="1">
<MarketIds>9430420</MarketIds>
</getPricesRequest>
</ns0:GetPrices>
</ns1:Body>
</SOAP-ENV:Envelope>
我得到的回应是:
DEBUG:suds.client:headers = {'SOAPAction': u'"http://www.GlobalBettingExchange.com/ExternalAPI/GetPrices"', 'Content-Type': 'text/xml; charset=utf-8'}
DEBUG:suds.client:http succeeded: *long xml here*
如您所见,我在每个 xml 请求中使用标题作为我的用户名和密码。但是当我得到响应时,标题中没有 cookie。
我想知道是否有可能以某种方式将 cookie 插入我的请求或类似的东西以实现持久性。 (就像在 RESTful 服务中使用 Session)
【问题讨论】:
标签: python web-services cookies soap