<div>Here's the open function for HttpAuthenticated.</div>
<div> </div>
<div>class HttpAuthenticated(HttpTransport):<br> """<br> Provides basic http authentication for servers that don't follow<br> the specified challenge / response model. This implementation<br>
appends the I{Authorization} http header with base64 encoded<br> credentials on every http request.<br> """<br> def open(self, request):<br> credentials = self.credentials()</div>
<div> theurl = request.url<br> username = credentials[0]<br> password = credentials[1]</div>
<div> passman = u2.HTTPPasswordMgrWithDefaultRealm()</div>
<div> passman.add_password(None, theurl, username, password)</div>
<div> authhandler = u2.HTTPBasicAuthHandler(passman)</div>
<div> opener = u2.build_opener(authhandler)<br> u2.install_opener(opener)</div>
<div> return HttpTransport.open(self, request)</div>
<div> </div>
<div><br><br> </div>
<div class="gmail_quote">On Mon, Dec 21, 2009 at 2:16 PM, Ryan Schroeder <span dir="ltr"><<a href="mailto:ryanitus@gmail.com">ryanitus@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>Hello,</div>
<div> </div>
<div>I have a server that requires basic HTTP authentication to download the WSDL file. I tried setting the transport to HTTPAuthenticated, but it looks like the Client doesn't apply the options.transport when opening the url.</div>
<div> </div>
<div>Here's the snippet I'm referring to from client.py:</div>
<div> </div>
<div> def __init__(self, url, **kwargs):</div>
<div> """</div>
<div> @param url: The URL for the WSDL.</div>
<div> @type url: str</div>
<div> @param kwargs: keyword arguments.</div>
<div> @see: L{Options}</div>
<div> """</div>
<div> options = Options()</div>
<div> options.transport = HttpAuthenticated()</div>
<div> self.options = options</div>
<div> options.cache = FileCache(days=1)</div>
<div> self.set_options(**kwargs)</div>
<div> self.wsdl = Definitions(url, options) <-------------- shouldn't this be self.options?</div>
<div> </div>
<div> </div>
<div>I tried making this change, but also ran into the fact that the HttpAuthenticated class does not override the open method using a provided username and password. The basic HttpTransport open method is called instead.</div>
<div> </div>
<div>Regards,</div>
<div> </div><font color="#888888">
<div>Ryan</div>
<div> </div></font></blockquote></div><br>