Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21408

Re: Can't get around HTTP/401 response using SUDS

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rafadurancastaneda@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:using': 0.04; 'soap': 0.05; 'user-agent:': 0.07; 'python': 0.08; 'x86_64': 0.09; '2.7': 0.13; 'useful,': 0.13; '136,': 0.16; '__init__': 0.16; 'adam': 0.16; 'bye': 0.16; 'connection:': 0.16; 'request)': 0.16; 'skip:" 80': 0.16; 'received:74.125.82.44': 0.16; 'received:mail- ww0-f44.google.com': 0.16; 'trace': 0.18; '(most': 0.21; 'apache': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'changed': 0.23; "shouldn't": 0.23; 'traceback': 0.24; 'code': 0.26; 'tried': 0.27; 'remote': 0.28; 'server.': 0.28; 'raise': 0.28; 'described': 0.28; 'skip:= 10': 0.28; "i'm": 0.28; 'server': 0.30; 'credentials.': 0.30; 'retry': 0.30; 'transport': 0.30; 'error': 0.30; 'usually': 0.31; 'message-id:@gmail.com': 0.31; 'skip:( 20': 0.31; 'version': 0.32; "i've": 0.32; 'does': 0.32; 'requests': 0.32; 'totally': 0.32; 'there': 0.33; 'header:User-Agent:1': 0.33; 'file': 0.34; 'subject:/': 0.34; 'last):': 0.34; 'from:charset:iso-8859-1': 0.35; 'problem.': 0.35; 'to:addr :python-list': 0.35; 'response': 0.36; 'received:74.125.82': 0.36; 'http': 0.37; 'url:ac': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'received:192': 0.38; 'useful': 0.38; 'think': 0.38; 'received:74.125': 0.38; 'getting': 0.38; 'open': 0.38; 'received:192.168.1': 0.39; 'goes': 0.39; 'header': 0.39; 'ok,': 0.39; 'client': 0.40; 'to:addr:python.org': 0.40; 'skip:s 40': 0.40; 'url:uk': 0.40; 'back': 0.60; 'personal': 0.61; 'your': 0.61; 'unauthorized': 0.61; 'reviewed': 0.62; 'williams': 0.63; 'bear': 0.64; 'url:0': 0.67; '30,': 0.74; 'url:2011': 0.78; '.......': 0.84; 'credentials': 0.84; 'subject:response': 0.91; 'url:14': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=i6vJqK9Nok4GrVWYM1zq/jUO4SgjzPaqt/JTVzuBPYU=; b=I2dvltLNTJ+JgRUWIooUm6YwnjD9N9xm+6CnMc7sNm3vxW5kL1PEhr/XS0rYh/zpdc nQVmFDXBDH6sW2lGp4K7+0Mo7CHCUb5EEhj0d0JcihhpgUOAGmDuuC4qatKjS12ypiJw henH8GT+0zhA6dCdsMxS0YOu4EO/nTHlhix1vNbIbVHsCTUsh4GvalNK2gv613n1RcZZ bGUYOHEXS21UYXvMZMypD5CB2krFHwtrNkjjZC9I5nfplEGdfR6kwGRw656+1W6XeNUe ZY2sPBx8kpoYVRGr5tvS43vqkzYqWEDzhtVusu6DkwSSh5+/5Z0U6yiqbNIV/eFrKWTJ 3YUw==
Date Fri, 09 Mar 2012 00:03:08 +0100
From Rafael Durán Castañeda <rafadurancastaneda@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
MIME-Version 1.0
To python-list@python.org
Subject Re: Can't get around HTTP/401 response using SUDS
References <1331221455.3087.14.camel@linux-dauq.site>
In-Reply-To <1331221455.3087.14.camel@linux-dauq.site>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.523.1331247792.3037.python-list@python.org> (permalink)
Lines 75
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1331247792 news.xs4all.nl 6952 [2001:888:2000:d::a6]:40386
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:21408

Show key headers only | View raw


El 08/03/12 16:44, Adam Tauno Williams escribió:
> SUDS version 0.4 pn x86_64 Python 2.7
>
> I'm having a bear of a time getting HTTP Basic Authentication to work
> for a SOAP request via suds.  Also using an HTTP proxy server.
>
> In WireShark I just see a request -
> GET http://...../services/services/JobService-0.0.1?wsdl HTTP/1.1
> Accept-Encoding: identity
> Host: .......
> Connection: close
> User-Agent: Python-urllib/2.7
>
> This doesn't contain any authentication credentials so the response is
> HTTP/401, and the client doesn't retry with credentials.  The response
> does come from the remote as I can see there is a WWW-Authenticate
> header and it is from an Apache Tomcat server - so it makes it through
> the proxy server.
>
> Code
> ================
>   url = 'http://....../services/services/JobService-0.0.1?wsdl'
>   proxy = urllib2.ProxyHandler({'http': 'http://.....:3128'})
>   transport = suds.transport.http.HttpAuthenticated()
>   transport.urlopener = urllib2.build_opener(proxy)
>   client = suds.client.Client(url, transport=transport,
> username='******', password='********')
> ....
>
> I've tried the above as well as the method described at
> <http://blogs.oucs.ox.ac.uk/inapickle/2011/05/14/exchange-web-services-suds-and-python/>   It has the same problem.
>
>
> Back Trace
> ================
> Traceback (most recent call last):
>    File "etrace.py", line 30, in<module>
>      client = suds.client.Client(url, transport=transport,
> username='*******', password='*****')
>    File
> "/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/client.py", line 112, in __init__
>      self.wsdl = reader.open(url)
>    File
> "/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/reader.py", line 152, in open
>      d = self.fn(url, self.options)
>    File
> "/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/wsdl.py", line 136, in __init__
>      d = reader.open(url)
>    File
> "/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/reader.py", line 79, in open
>      d = self.download(url)
>    File
> "/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/reader.py", line 95, in download
>      fp = self.options.transport.open(Request(url))
>    File
> "/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/transport/http.py", line 173, in open
>      return HttpTransport.open(self, request)
>    File
> "/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/transport/http.py", line 64, in open
>      raise TransportError(str(e), e.code, e.fp)
> suds.transport.TransportError: HTTP Error 401: Unauthorized
>
When I've got issues like yours, I usually try using a console client 
(telnet/curl/wget,...) adding all needed headers/data manually so I'm 
totally sure the request is OK, if everything goes Ok you know your 
python code need to be reviewed but when you are under proxies you can 
find a lot of not python related issues (bad gateways, using proxy when 
it shouldn't or vice-versa, requests changed by proxy,....).

wireshark can be very useful but in situations like this I usually 
prefer tcpflow output, I think the request/response flow showed is 
really useful, but that's a personal preference.

HTH,
bye

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Can't get around HTTP/401 response using SUDS Rafael Durán Castañeda <rafadurancastaneda@gmail.com> - 2012-03-09 00:03 +0100

csiph-web