RDFLib / sparqlwrapper

A wrapper for a remote SPARQL endpoint
https://sparqlwrapper.readthedocs.io/
Other
526 stars 122 forks source link

HTTP 403 with SPARQLWrapper default user agent when querying Wikidata #237

Closed lu-pl closed 1 month ago

lu-pl commented 2 months ago

As of today, I get HTTP 403 Forbidden when running queries against Wikidata using SPARQLWrapper.

E.g. the following results in 403:

from SPARQLWrapper import JSON, SPARQLWrapper

sparql_wrapper = SPARQLWrapper(
    "https://query.wikidata.org/bigdata/namespace/wdq/sparql"
)
sparql_wrapper.setReturnFormat(JSON)
sparql_wrapper.setQuery("select * where {?s ?p ?o} limit 1")
sparql_wrapper.query()

The problem does not occur when I explicitly set the user agent with the agent parameter in SPARQLWrapper.

I know that this has been discussed before (see #139) and I know that the Wikidata user agent policy requires/recommends to set the agent parameter with SPARQLWrapper.

What puzzles me is that not setting the agent explicitly worked until today.