Skip to content

Instantly share code, notes, and snippets.

@moacirmoda
Last active August 14, 2018 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moacirmoda/ce66c3399f23f931adf23976dbc0da2e to your computer and use it in GitHub Desktop.
Save moacirmoda/ce66c3399f23f931adf23976dbc0da2e to your computer and use it in GitHub Desktop.
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<ns0:User xmlns:ns0="http://www.b2breservas.com.br/b2bws/types/">xxx</ns0:User>
<ns1:Password xmlns:ns1="http://www.b2breservas.com.br/b2bws/types/">xxx</ns1:Password>
</soap-env:Header>
<soap-env:Body>
<ns0:OTA_PingRQ EchoToken="1234" Version="3.000" xmlns:ns0="http://www.opentravel.org/OTA/2003/05/alpha">
<ns0:EchoData>1</ns0:EchoData>
</ns0:OTA_PingRQ>
</soap-env:Body>
</soap-env:Envelope>
import zeep
import logging
from requests import Session
# You must initialize logging, otherwise you'll not see debug output.
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
USERNAME = 'xxx'
PASSWORD = 'xxx'
session = Session()
wsdl = 'http://homolog.b2breservas.com.br:8080/b2bws-homolog-v2/OTAHotel?wsdl'
client = zeep.Client(wsdl=wsdl, transport=zeep.transports.Transport(session=session))
headers = {
'user': USERNAME,
'password': PASSWORD,
}
data = {
'Version': "3.000",
'EchoToken': '1234',
'EchoData': '1',
}
ping = client.service.Ping(**data, _soapheaders=headers)
print(ping)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment