首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >连接到Amadeus (使用python的http://webservices.amadeus.com/) soap api连接

连接到Amadeus (使用python的http://webservices.amadeus.com/) soap api连接
EN

Stack Overflow用户
提问于 2014-03-15 23:28:27
回答 1查看 4.7K关注 0票数 2

我是python的新手,因为我以前没有用过Amadeus API,我试着从Amadeus(http://webservices.amadeus.com/) soap API建立连接,我有.wsdl文件,我想用Python发送请求和获取响应。我看过SOAPpy、suds,并尝试使用它,就像下面这个例子:

sending a soap request from python

但是我不能确定请求是否会发送到服务器,如果请求要发送,如何获取响应数据。

请帮我提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2014-03-17 22:32:20

如果为传输库启用调试日志记录,则。

代码语言:javascript
复制
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.transport.http').setLevel(logging.DEBUG)

您将能够在日志输出中看到类似以下内容:

代码语言:javascript
复制
DEBUG:suds.transport.http:sending:
URL: http://someurl
HEADERS: {'SOAPAction': '"http://blablabla/identityCheck"', 'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'Soapaction': '"http://blablabla/blablabla"'}
MESSAGE: <xml......>
DEBUG:suds.transport.http:received:
CODE: 200
HEADERS: {'header1': 'blablabla'}
MESSAGE: <xml......>

此外,您还可以打印出服务结果对象。这里假设我在端点中有一个名为identityCheck的方法,并将其customer作为输入。

代码语言:javascript
复制
client = Client(wsdl_url, location=endpoint_url)
customer = client.factory.create('customer')
customer.userId = 'A'
customer.password = 'B'

result = client.service.identityCheck(customer)
print result
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22425759

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档