ClimateCompatibleGrowth / GeoH2

Geospatial analysis of green hydrogen production costs.
MIT License
13 stars 4 forks source link

GeocoderInsufficientPrivileges in cost_by_component.py #6

Closed clairehalloran closed 5 months ago

clairehalloran commented 6 months ago

When running cost_by_component.py, I get the following error message:

Traceback (most recent call last):

  File ~\miniforge3\envs\geoh2\lib\site-packages\geopy\geocoders\base.py:368 in _call_geocoder
    result = self.adapter.get_json(url, timeout=timeout, headers=req_headers)
  File ~\miniforge3\envs\geoh2\lib\site-packages\geopy\adapters.py:472 in get_json
    resp = self._request(url, timeout=timeout, headers=headers)
  File ~\miniforge3\envs\geoh2\lib\site-packages\geopy\adapters.py:500 in _request
    raise AdapterHTTPError(
AdapterHTTPError: Non-successful status code 403

The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File ~\miniforge3\envs\geoh2\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)
  File c:\users\clair\onedrive - nexus365\dphil\geoh2-private\costs_by_component.py:46
    location = geolocator.reverse(coordinates)
  File ~\miniforge3\envs\geoh2\lib\site-packages\geopy\geocoders\nominatim.py:372 in reverse
    return self._call_geocoder(url, callback, timeout=timeout)
  File ~\miniforge3\envs\geoh2\lib\site-packages\geopy\geocoders\base.py:388 in _call_geocoder
    res = self._adapter_error_handler(error)
  File ~\miniforge3\envs\geoh2\lib\site-packages\geopy\geocoders\base.py:411 in _adapter_error_handler
    raise exc_cls(str(error)) from error

GeocoderInsufficientPrivileges: Non-successful status code 403

Per https://github.com/geopy/geopy/issues/314, it seems like using Photon instead of Nominatim could solve this problem.