geocoder
geocoder copied to clipboard
geocoder.osm error cod 403
When using geocoder.osm('Berlin'), python returns an error.
Status code 403 from https://nominatim.openstreetmap.org/search: ERROR - 403 Client Error: Forbidden for url: https://nominatim.openstreetmap.org/search?q=Berlin&format=jsonv2&addressdetails=1&limit=1
Same here (only on Windows computer). On macOS everything's working as usual.
Add the following function in the class OsmQuery(MultipleResultsQuery) in osm.py def _build_headers(self, provider_key, **kwargs): """Will be overridden according to the targetted web service""" return {"User-Agent": 'My User Agent 1.0'} This should be work. Reference: https://help.openstreetmap.org/questions/74205/nominatim-usage-policy-http-referers-and-user-agents