Skip to content

Instantly share code, notes, and snippets.

@wikier
Last active March 29, 2018 20:30
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wikier/38c0e3a4925b0bb81dd0 to your computer and use it in GitHub Desktop.
Save wikier/38c0e3a4925b0bb81dd0 to your computer and use it in GitHub Desktop.
SPARQLWrapper HTTP Digest Auth example
from SPARQLWrapper import SPARQLWrapper, JSON, DIGEST
sparql = SPARQLWrapper("http://example.org/sparql")
sparql.setHTTPAuth(DIGEST)
sparql.setCredentials('login', 'password')
sparql.setQuery("...")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
@Skorkmaz88
Copy link

Shouldn't it be 'DIGEST', as https://rdflib.github.io/sparqlwrapper/doc/latest/SPARQLWrapper.Wrapper.SPARQLWrapper-class.html#setHTTPAuth, states it should be string as parameter, and unless defined elsewhere, 'BASIC' and 'DIGEST' are only valid options so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment