Closed GoogleCodeExporter closed 8 years ago
I had to make this change as well. You can pass in headers to authenticate when
you call the wsdl methods with:
encoded = base64.b64encode("%s:%s" % (username, password))
client = SoapClient(wsdl=u, trace=True,
http_headers={'Authorization': 'Basic %s' % encoded})
....BUT if your wsdl definition is behind http authentication as well, those
headers are not passed into the self.http method, which makes the above fix a
requirement for wsdl's behind http auth.
Until this change is in, I have to keep a clone of the repo? No pull requests
on google code either?
Anyone know when this three liner can be added?
And the if statement should probably be:
if hasattr(self.http, 'add_credentials') and username and password:
Original comment by curran...@gmail.com
on 20 Dec 2013 at 4:58
Merged, thanks!
Please run the tests and report any new issue!
Thanks again for your contribution
Original comment by reingart@gmail.com
on 20 Dec 2013 at 5:43
Issue 126 has been merged into this issue.
Original comment by reingart@gmail.com
on 20 Dec 2013 at 7:52
Hello,
There seem to be an issue with simple auth between python 2.7.3 (debian stable)
and 2.6.8. pysimplesoap version 1.13.
The adding of username and password works in 2.6.8 but does not work in 2.7.3
{{{
Python 2.6.8 (unknown, Jan 26 2013, 14:35:25)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pysimplesoap.client import SoapClient, SoapFault, SimpleXMLElement
>>> url='https://xxxxx?WSDL'
>>> client = SoapClient(wsdl=url, username="myuser",password="mysecretpass")
>>>
}}}
{{{
(env2)lucas@delle6510:~/tmp/12/pysimplesoap$ python
Python 2.7.3 (default, Jan 2 2013, 13:56:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pysimplesoap.client import SoapClient, SoapFault, SimpleXMLElement
>>> url='https://xxxx?WSDL'
>>> client = SoapClient(wsdl=url, username="sss",password="rrrr")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pysimplesoap/client.py", line 164, in __init__
self.services = wsdl and self.wsdl_parse(wsdl, cache=cache)
File "pysimplesoap/client.py", line 520, in wsdl_parse
xml = fetch(url, self.http, cache, force_download, self.wsdl_basedir)
File "pysimplesoap/helpers.py", line 77, in fetch
response, xml = http.request(url, 'GET', None, {})
File "pysimplesoap/transport.py", line 135, in request
f = self.request_opener(req, timeout=self._timeout)
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 407, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 445, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 401: Unauthorized
}}}
Original comment by szybal...@gmail.com
on 15 May 2014 at 10:27
Hello,
Looks like httplib2 is required to make pysimplesoap basic http authentication
working. My python2.6 had it while 2.7 didn't. Installing httplib2 fixes the
issue.
pip install httplib2
or
aptitude install python-httplib2
Looks like without it this does not work. Not sure if httplib2 should be
require as part of this package dependency.
Also as a reference this ticket code changes is checked into 1.12 version not
currently available in easy_install or pip as of 5/16/2014. You have to get the
source which is at 1.13
Original comment by szybal...@gmail.com
on 16 May 2014 at 4:42
Hi,
I just now did a pip install pysimplesoap and py install httplib2 on Python 3.4.
I get this:
Traceback (most recent call last):
File "pythonsoap.py", line 6, in <module>
client = SoapClient(wsdl="wsdlserver/path?wsdl",username=username,password=password)
TypeError: __init__() got an unexpected keyword argument 'username'
Is by any chance this fix not included in version 10?
Original comment by johan...@gmail.com
on 14 Jan 2015 at 9:22
Original issue reported on code.google.com by
andy.kin...@gmail.com
on 1 Sep 2013 at 3:28