Error: (429) Too Many Requests.

I wrote a GIS, based on dotspatial and fetching OSM tiles (via C#-WebClient). Everything worked fine in May last year.
Now I get an error when trying to download tiles from OSM server. I use e. g. the command “http://tile.openstreetmap.org/11/1076/659.png”.
Using a browser I receive the desired tile. But using my desktop GIS, I receive the error message: “Error: (429) Too Many Requests.”
What can I do?

You are nearly guaranteed to be violating the ToU (enforcement of which is now slightly stricter than it used to be), see:

https://operations.osmfoundation.org/policies/

How can I generate a valid HTTP User-Agent?
What is a valid HTTP Referer?

I had the same problem with a python app. Fixed it now as follows:

from urllib3 import PoolManager
user_agent = {‘user-agent’: ‘My program name and version number contact myname@myuni.ac.uk’}
http = PoolManager(headers=user_agent)
url = ‘https://a.tile.openstreetmap.org/15/16311/10815.png
response = http.request(‘GET’, url)

Good practice apparently is to put a proper email address in the text, but otherwise free format.

Hi !

I got that problem to build a png image from PHP 5.6. Function getimagesize and imagecreatefrompng return Error: (429) Too Many Requests from december 2019.

To solve this (thanx to previous answer), I just modifi user_agent property in php.ini defaul is ‘PHP’, I think that OSM drop connection with this user_agent.
I put
user_agent = ‘[My program name] [version number] contact [contact@adress.com]’

With this header OSM accept the connection and my php script work.

Thanx.

En français :
J’ai rencontré ce problème pour construire une image PNG a partir d’OSM en PHP 5.6. Les fonction getimagesize et imagecreatefrompng me retournaient une erreur (429) Too Many Requests depuis décembre 2019 et la migration des serveurs OSM.

Pour résoudre ce problème (merci à la réponse précédente) j’ai modifié la propriété user_agent=‘PHP’ dans php.ini. Je pense que par défaut les user_agent ‘PHP’ sont dropé car tout les script ‘PHP’ ont cet user_agent et OSM pense qu’il y a trop de connexion dessus.

J’ai mis user_agent = ‘[My program name] [version number] contact [contact@adress.com]’

Avec ce header OSM accept mes connection et mon script fonctionne.

Merci.

Hello,

I get the same problem which stat today on my website…
I am using javascript to load the tile.
And I get an error 429, with no tile load.

How can i fix this ?

Thanks for the helpfull answers. With such an user agent string, consisting of company, version and e-mail address, I get tiles now. For about three or four screens (with appr. 80-100 tiles) it works in an acceptable speed. But after this, it goes slower and slower …

please help,
I tried to put a valid user agent in my PHP Curl request but still my tile proxy can’t get the tiles… I really would like to not overload OSM servers with requests, but if my proxy doesn’t work I have to call them directly

I use a modified version of this proxy: https://wiki.openstreetmap.org/wiki/ProxySimplePHP

any help would be appreciated

@Fabio i have the same problem. Do you have a solution in the meantime?