maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
226 stars 24 forks source link

SPARQL get requests fail #79

Closed nichtich closed 5 years ago

nichtich commented 5 years ago
$ cat test.sparql 
SELECT ?t { wd:Q42 wdt:P31 ?t }
$ wd sparql -v test.sparql 
Generated get query: https://query.wikidata.org/sparql?format=json&query=SELECT%20%3Ft%20%7B%20wd%3AQ42%20wdt%3AP31%20%3Ft%20%7D%0A
Error: 403 Forbidden

GET request to the same URL with curl works. Patching lib/make_sparql_query.js to force POST request also works. I also tests other SPARQL queries. Finally I found out that the SPARQL endpoints expects a User-Agent header.

maxlath commented 5 years ago

patch to add a User-Agent published in v7.5.1