Created
May 3, 2020 02:53
-
-
Save takahirohonda/f373f05d60ddfab84cc9d6e42c90d791 to your computer and use it in GitHub Desktop.
qas-do-search.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, json, xmltodict | |
request_url = 'https://ws.ondemand.qas.com/ProOnDemand/V3/ProOnDemandService.asmx?WSDL=' | |
qas_token = '<add your token>' | |
soap_action = 'http://www.qas.com/OnDemand-2011-03/DoSearch' | |
headers = { | |
'Content-Type':'text/xml', | |
'Auth-Token':qas_token, | |
'SOAPAction': soap_action | |
} | |
xml = '<?xml version="1.0" encoding="UTF-8" ?>\ | |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ond="http://www.qas.com/OnDemand-2011-03">\ | |
<soapenv:Header>\ | |
<ond:QAQueryHeader />\ | |
</soapenv:Header>\ | |
<soapenv:Body>\ | |
<ond:QASearch>\ | |
<ond:Country>AUS</ond:Country>\ | |
<ond:Engine Flatten="true" Intensity="Close" PromptSet="Default" Threshold="5" Timeout="10000">Intuitive</ond:Engine>\ | |
<ond:Layout></ond:Layout>\ | |
<ond:Search>101 Colll</ond:Search>\ | |
</ond:QASearch>\ | |
</soapenv:Body>\ | |
</soapenv:Envelope>' | |
r = requests.post(request_url, data=xml, headers=headers) | |
json_results = json.dumps(xmltodict.parse(r.text)) | |
print(json_results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment