我有一个包含超过 6k 个地址条目的数据库,因此我已经安装了带有 docker 的 nominatim 服务器来进行地理编码工作。它在“localhost:8080”上的 Web 表单中正常工作。
但是,当我尝试在 jupyter 中使用 geopy 进行查询时。它总是抛出错误。
我的 Jupyter 代码:
from geopy.geocoder import Nominatim
nom=Nominatim(domain='http://localhost:8080')
nom.geocode('some address') #the address works on the public server
Run Code Online (Sandbox Code Playgroud)
错误堆栈:
---------------------------------------------------------------------------
gaierror Traceback (most recent call last)
/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1253 try:
-> 1254 h.request(req.get_method(), req.selector, req.data, headers)
1255 except OSError as err: # timeout error
/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py in request(self, method, url, body, headers)
1105 """Send a complete request to the server."""
-> 1106 self._send_request(method, url, …Run Code Online (Sandbox Code Playgroud)