Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TooManyRequests Overpass Error

I'm using overpy to query the Overpass API, and the nature of the data is such that I have a lot of queries to execute. I've run into the 429 OverpassTooManyRequests exception and I'm trying to play by the rules. I've tried introducing time.sleep methods to space out the requests, but I have no basis for how long the program should wait before continuing.

I found this link which mentions a "Retry-after" header:
How to avoid HTTP error 429 (Too Many Requests) python

Is there a way to access that header in an overpy response? I've been through the docs and the source code, but nothing stood out that would allow me to access that header so I can pause querying until it's acceptable to do so again.

I'm using Python 3.6 and overpy 0.4.

like image 706
Chris M. Avatar asked Apr 26 '17 13:04

Chris M.


2 Answers

Maybe this isn't quite the answer you're seeking, but I ran into the same issue and fixed it by simply hosting my own OSM database server using docker. Just clone the repo and follow instructions:

https://github.com/mediasuitenz/docker-overpass-api

like image 125
B.abba Avatar answered Oct 01 '22 21:10

B.abba


from http://overpass-api.de/command_line.html do check that you do not have a single 'runaway' request that is taking up all the resources.

like image 44
Rene Avatar answered Oct 01 '22 20:10

Rene