fhamborg / Giveme5W1H

Extraction of the journalistic five W and one H questions (5W1H) from news articles: who did what, when, where, why, and how?
Apache License 2.0
505 stars 87 forks source link

Error from GeoPy #87

Open dsagman opened 9 months ago

dsagman commented 9 months ago

Describe the bug Error from Geopy: Using Nominatim with default or sample user_agent "geopy/2.4.1" is strongly discouraged, as it violates Nominatim's ToS https://operations.osmfoundation.org/policies/nominatim/ and may possibly cause 403 and 429 HTTP errors.

Error seems to be coming from: /Giveme5W1H/extractor/extractors/environment_extractor.py line 55.

To Reproduce Fresh install on Mac OS, attempting to run sample code for a single text from the examples directory. Using a virtual env for installing python modules.

Expected behavior Get 5Ws from sample text.

Log ConfigurationError: Using Nominatim with default or sample user_agent "geopy/2.4.1" 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".

Versions (please complete the following information):

brynkim commented 7 months ago

I'm not technically sure, but for me this seemed to be an issue derived from geopy.

The exactly same error message can be found in here.

I've solved (maybe?) it by changing line 55 of Giveme5W1H.extractor.extractors.environment_extractor.py file as

self.geocoder = Nominatim(domain=host, timeout=8)

into

self.geocoder = Nominatim(domain=host, timeout=8, user_agent='MY_USER_AGENT')

where MY_USER_AGENT is a random string.