From: Rodrigo D. A. S. <rod...@co...> - 2012-12-27 19:14:51
|
Hola Carlos! Sorry for taking so long to thank you about this issue. I ended up locally patching the project, my solution is similar to what Willian Waites produced. One difference is that I changed setCredentials() as shown below: <code> def setCredentials(self, user, passwd, mode='basic', realm='') : """ Set the credentials for querying the current endpoint. Mode by default is set to basic, but could also be set to 'digest'. If mode is set to 'digest' you should also specify realm. @param user: username @type user: string @param passwd: password @type passwd: string @param mode: mode @type mode: string @param realm: realm @type realm: string """ self.user = user self.passwd = passwd self.realm = realm self.auth_mode = mode </code> The attributes self.user, self.password, etc are used in _createRequest() as follows: <code> def _createRequest(self) : """Internal method to create request according a HTTP method. Returns a C{urllib2.Request} object of the urllib2 Python library @return: request """ # CAREFUL CODE OMITTED HERE! # Figure out URI if self.method == POST : uri = self.baseURI else: uri = self._getURI() if (self.auth_mode=='digest') and self.user and self.passwd: passwdmngr = urllib2.HTTPPasswordMgrWithDefaultRealm() passwdmngr.add_password(self.realm, uri, self.user, self.passwd) authhandler = urllib2.HTTPDigestAuthHandler(passwdmngr) opener = urllib2.build_opener(authhandler) urllib2.install_opener(opener) # .... </code> Anyways, thank you all for the work in SPARQLWrapper and for the help in this issue in particular. bets regards, Rod Senra http://rodrigo.senra.nom.br ---------- Forwarded message ---------- From: Carlos Tejo <car...@fu...> Date: Mon, Dec 10, 2012 at 6:19 AM Subject: Re: [sparql-wrapper-devel] Digest Auth Support To: spa...@li... Dear Rodrigo, Thanks to arise this issue. I have uploaded the patch provided by Willian Waites. It is available at [1] Cheers, [1] https://sourceforge.net/p/sparql-wrapper/feature-requests/2/#2b6f |