Avoid returncode 429 (MultipleRequestsError) by passing customizable user-agent and from fields
See original GitHub issueI just ran into an issue along the lines of the one described here. The Overpass API would suddenly return 429 where it had previously just worked. As it turns out, this may be due to a (temporary) restriction, which can be avoided by sending custom user-agent and from headers.
I solved it by modifying the following bit of code in overpass like this:
try:
r = requests.post(
self.endpoint,
data=payload,
timeout=self.timeout,
headers={
'Accept-Charset': 'utf-8;q=0.7,*;q=0.7',
'From': 'somebody@website.xyz',
'Referer': 'http://www.website.xyz/',
'User-Agent': 'overpass-api-python-wrapper (Linux x86_64)'
}
)
I’d love it if those fields were customizable through the API class constructor.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Error 429 with simple query on google with requests python
Since you are getting status code 429 which means you have sent too many requests in a given amount of time ("rate limiting")....
Read more >How to Fix 429 Too Many Requests Error - Kinsta
The HTTP 429 error is returned when too many requests are made to a page ... It's a server telling you to please...
Read more >429 Error – Too Many Requests HTTP Code Explained
In this article, I will explain what the 429 error means and how a developer might have implemented ... this is how I...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
HTTP 429 means that you’re hitting the rate limiter by sending too many and/or too expensive queries. Check /api/status to find out how many seconds you need to wait before sending the next request.
Obviously, putting in a suitable User Agent is always a plus, but won’t affect the overall HTTP 429 logic in any way.
BTW: Issue was reported here (#38) before, but closed again as noone was picking it up for quite a while. Great, that there’s some follow up now!
With comment from @mmd-osm, closing this issue for now. Feel free to re-open if you see a good path forward with this.