Skip to content Skip to sidebar Skip to footer

Sparqlwrapper Http Error 401: Unauthorized

I secured my SPARQL endpoint via SQL Accounts according to VirtSPARQLProtectSQLDigestAuthentication. Before this operation, I can get the data through the code: from SPARQLWrap

Solution 1:

Well, I found the answer just several minutes after I wrote the problem, which reminds me of RTFSC again.

line 574~581 in Wrapper.py :

elif self.http_auth == DIGEST:
    realm = "SPARQL"
    pwd_mgr = urllib2.HTTPPasswordMgr()
    pwd_mgr.add_password(realm, uri, self.user, self.passwd)
    opener = urllib2.build_opener()
    opener.add_handler(urllib2.HTTPDigestAuthHandler(pwd_mgr))
    urllib2.install_opener(opener)

Besides user and password, there is another varible,realm.(default value is "SPARQL"), but VirtSPARQLProtectSQLDigestAuthentication set the realm as "SPARQL Endpoint".

So the solution is just changing your virtuoso's realm to "SPARQL".

Post a Comment for "Sparqlwrapper Http Error 401: Unauthorized"