Опять уткнулся в ту-же проблему с авторизацией в urllib2 в друрой задаче:
import ssl
from pysimplesoap.client import SoapClient
ssl._create_default_https_context = ssl._create_unverified_context
client = SoapClient(wsdl="http://127.0.0.1:5000/service.htms.xml",trace=True)
client['AuthHeaderElement'] = {'username': '---', 'password': '---'
response = client.onyma_api_audit_dog_list()
result = response
print result
Данные не получаю. Видимо из-за авторизации.
DEBUG:pysimplesoap.client:content-length: 434
x-powered-by: PHP/5.6.22
set-cookie: PHPSESSID=5288c5918a42b6814d3ea630acf2115d; path=/
expires: Thu, 19 Nov 1981 08:52:00 GMT
vary: Accept-Encoding
server: Apache/2.4.20 (Unix) PHP/5.6.22 OpenSSL/1.0.2h mod_wsgi/3.5 Python/2.7.11
connection: close
pragma: no-cache
cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
date: Thu, 15 Dec 2016 01:30:56 GMT
content-type: text/xml;charset=UTF-8
DEBUG:pysimplesoap.client:<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>Client</faultcode><faultstring>Session doesn't exist</faultstring><detail><exceptionName>ru.onyma.www.services.OnymaApi.types.T_exception</exceptionName><code>0</code></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Traceback (most recent call last):
File "./soap.py", line 11, in <module>
response = client.onyma_api_audit_dog_list()
File "/home/vak/.virtualenvs/iss/local/lib/python2.7/site-packages/pysimplesoap/client.py", line 181, in <lambda>
return lambda *args, **kwargs: self.wsdl_call(attr, *args, **kwargs)
File "/home/vak/.virtualenvs/iss/local/lib/python2.7/site-packages/pysimplesoap/client.py", line 346, in wsdl_call
return self.wsdl_call_with_args(method, args, kwargs)
File "/home/vak/.virtualenvs/iss/local/lib/python2.7/site-packages/pysimplesoap/client.py", line 370, in wsdl_call_with_args
response = self.call(method, *params)
File "/home/vak/.virtualenvs/iss/local/lib/python2.7/site-packages/pysimplesoap/client.py", line 269, in call
fault = operation['faults'][detailXml.children()[0].get_name()]
KeyError: u'exceptionName'
Может кто знает, в чем дело?