Hi Andra,

Pywikibot should take care of that for you, see https://github.com/wikimedia/pywikibot/blob/master/pywikibot/comms/http.py#L317


On 02-11-19 11:36, Andra Waagmeester wrote:

    I hope this is the right mailing list to discuss this issue. 
Some time ago I ran into a series of temporary bans, I thought I managed to tackle this basically by doing a full stop once it gets any response header code other than 200. 

However, this seems not to have fixed it, since I received the following message:

"requests.exceptions.HTTPError: 403 Client Error: You have been banned until 2019-10-18T10:21:36.495Z, please respect throttling and retry-after headers. for url: https://query.wikidata.org/sparql"

I am looking into this from scratch and see if I can implement a better solution and certainly one that really respects the retry-after time instead of going full stop. 

Whatever I try now, I keep getting 200 headers and I don't want to start an excessive bot run to get into a ban state to see the exact header that the bot needs to respect. 

Is there an example of such a header which I can use to make my own test script?

Or is there example python could that successfully deals with a retry-after header?



Wikidata-tech mailing list