I'm new on programing, and I'm using a programing tutorial which said that to use geopy
like this:
import pandas, os, geopy
from geopy.geocoders import Nominatim
GeoLocator = Nominatim()
but after the last line I'm getting this error:
/usr/local/lib/python3.7/site-packages/geopy/geocoders/osm.py:143: UserWarning: Using Nominatim with the default "geopy/1.17.0"
user_agent
is strongly discouraged, as it violates Nominatim's ToS https://operations.osmfoundation.org/policies/nominatim/ and may possibly cause 403 and 429 HTTP errors. Please specify a customuser_agent
withNominatim(user_agent="my-application")
or by overriding the defaultuser_agent
:geopy.geocoders.options.default_user_agent = "my-application"
. In geopy 2.0 this will become an exception. UserWarning
My question is, how should I change my code to fix this error?
nom = Nominatim(user_agent="http")
you have to mention your useragent(HTTP) its just about IP adress
You should specify a user_agent. The Nominatum service runs on donated servers which have limited capacity, so specifying a user-agent field allows Open Street Map to track more easily who is using their service. See here for a more detailed answer.
If you don't they may block your IP address from accessing the service as that would be a violation of their terms of service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With