RDFLib / sparqlwrapper

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

Dealing with HTTP 429 errors? #138

Open edent opened 5 years ago

edent commented 5 years ago

After running a few too many queries against WikiData, I received the following error from sparqlwrapper:

urllib.error.HTTPError: HTTP Error 429: Too Many Requests

I know the correct answer is for me to be more efficient with my queries, but is there any way to make sparqlwrapper slow down?

Wikidata uses a Retry-After header to let clients know when they can continue (https://www.mediawiki.org/wiki/Wikidata_Query_Service/User_Manual#Query_limits) - is there any way to incorporate that information into my code?

Thanks for the brilliant library - has been extremely useful.

dayures commented 5 years ago

@edent thanks for the feedback. I tried to reproduce the issue in my laptop, but I was unsucessful. Meanwhile, I have started some kind of support for 429 HTTP code. Could you test it and provide feedback (in order to incorporate it on master branch) ? Thanks!