question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoid returncode 429 (MultipleRequestsError) by passing customizable user-agent and from fields

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mmd-osmcommented, Mar 15, 2018

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!

0reactions
mvexelcommented, Mar 22, 2022

With comment from @mmd-osm, closing this issue for now. Feel free to re-open if you see a good path forward with this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found