问题
I recently downloaded geopy and tested it out on Jupyter's notebook with the code below.
import geopy
from geopy.geocoders import Nominatim
nom=Nominatim(scheme="http")
After running this I received the following error:
---------------------------------------------------------------------------
ConfigurationError Traceback (most recent call last)
<ipython-input-2-899501bc88f0> in <module>
----> 1 nom=Nominatim(scheme="http")
c:\users\****\appdata\local\programs\python\python38-32\lib\site-
packages\geopy\geocoders\nominatim.py in __init__(self, timeout, proxies, domain, scheme, user_agent, ssl_context, adapter_factory)
103 if (self.domain == _DEFAULT_NOMINATIM_DOMAIN
104 and self.headers['User-Agent'] in _REJECTED_USER_AGENTS):
--> 105 raise ConfigurationError(
106 'Using Nominatim with default or sample `user_agent` "%s" is '
107 'strongly discouraged, as it violates Nominatim\'s ToS '
ConfigurationError: Using Nominatim with default or sample `user_agent` "geopy/2.0.0" 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 custom `user_agent` with `Nominatim(user_agent="my-application")` or by overriding the default `user_agent`: `geopy.geocoders.options.default_user_agent = "my-application"`.`
I tried the same thing on Pycharm and received the same error. Also tried searching around but couldn't seem to find anything pertaining to my problem. Would appreciate the help. Thanks.
来源:https://stackoverflow.com/questions/63256415/nominatim-returns-a-configuration-error-after-assigning-a-variable-to-it