Developer Q&A
How to connect to API with Python?
I am having trouble finding documentation to support connecting to the Corrigo APIs, and calling on methods using Python. Can anyone give me some general direction to get me started with a Python example?
Here is what I have tried so far, with and without the query variable as params:
import requests
corrigo_api_url = 'http://am-ce96a.corrigo.com/wsdk/CorrigoService.asmx?wsdl'
corrigo_headers = {
'Request Headers': 'SOAPAction :
"http://corrigo.com/integration/GetCompanyWsdkUrl"',
'Connection': 'Keep-Alive',
'User-Agent': 'Apache-HttpClient/4.5.2 (Java/1.8.0_162)',
'Host': 'am-apilocator.corrigo.com',
'Accept-Encoding': 'gzip,deflate',
'Content-Length': '384',
'Content-Type': 'text/xml;charset=UTF-8',
}
query = {
'xmlns': 'soapenv="http://schemas.xmlsoap.org/soap/envelope/"',
'CompanyName': 'MY COMPANY TEST ENV NAME',
'Protocol': 'HTTPS',
}
response = requests.get(url=corrigo_api_url, headers=corrigo_headers, params=query)
print(response.text)*
***using response.text to get an idea of what type of data is being returned to determine next steps. Any guidance on how to accurately retrieve a response is appreciated, along with any additional guidance on calling upon methods once a response is received.