python - own Nominatim server not working with geopy -


i have database of on 6k entries of addresses need geocoding, have installed nominatim server docker geocoding work. works should in web form on 'localhost:8080'.

however, when try query geopy in jupyter. throws error time.

my jupyter code:

from geopy.geocoder import nominatim nom=nominatim(domain='http://localhost:8080') nom.geocode('some address') #the address works on public server 

the error stack:

--------------------------------------------------------------------------- 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 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 complete request server.""" -> 1106         self._send_request(method, url, body, headers)    1107   /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/http/client.py in _send_request(self, method, url, body, headers)    1150             body = _encode(body, 'body') -> 1151         self.endheaders(body)    1152   /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/http/client.py in endheaders(self, message_body)    1101             raise cannotsendheader() -> 1102         self._send_output(message_body)    1103   /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/http/client.py in _send_output(self, message_body)     933  --> 934         self.send(msg)     935         if message_body not none:  /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/http/client.py in send(self, data)     876             if self.auto_open: --> 877                 self.connect()     878             else:  /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/http/client.py in connect(self)    1251  -> 1252             super().connect()    1253   /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/http/client.py in connect(self)     848         self.sock = self._create_connection( --> 849             (self.host,self.port), self.timeout, self.source_address)     850         self.sock.setsockopt(socket.ipproto_tcp, socket.tcp_nodelay, 1)  /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/socket.py in create_connection(address, timeout, source_address)     692     err = none --> 693     res in getaddrinfo(host, port, 0, sock_stream):     694         af, socktype, proto, canonname, sa = res  /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/socket.py in getaddrinfo(host, port, family, type, proto, flags)     731     addrlist = [] --> 732     res in _socket.getaddrinfo(host, port, family, type, proto, flags):     733         af, socktype, proto, canonname, sa = res  gaierror: [errno 8] nodename nor servname provided, or not known  during handling of above exception, exception occurred:  urlerror                                  traceback (most recent call last) /users/nmbqz/.virtualenvs/scrapy/lib/python3.5/site-packages/geopy/geocoders/base.py in _call_geocoder(self, url, timeout, raw, requester, deserializer, **kwargs)     142         try: --> 143             page = requester(req, timeout=(timeout or self.timeout), **kwargs)     144         except exception error: # pylint: disable=w0703  /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)     162         opener = _opener --> 163     return opener.open(url, data, timeout)     164   /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/urllib/request.py in open(self, fullurl, data, timeout)     465  --> 466         response = self._open(req, data)     467   /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/urllib/request.py in _open(self, req, data)     483         result = self._call_chain(self.handle_open, protocol, protocol + --> 484                                   '_open', req)     485         if result:  /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)     443             func = getattr(handler, meth_name) --> 444             result = func(*args)     445             if result not none:  /usr/local/cellar/python3/3.5.2_3/frameworks/python.framework/versions/3.5/lib/python3.5/urllib/request.py in https_open(self, req)    1296             return self.do_open(http.client.httpsconnection, req, -> 1297                 context=self._context, check_hostname=self._check_hostname)    1298   /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)    1255             except oserror err: # timeout error -> 1256                 raise urlerror(err)    1257             r = h.getresponse()  urlerror: <urlopen error [errno 8] nodename nor servname provided, or not known>  during handling of above exception, exception occurred:  geocoderserviceerror                      traceback (most recent call last) <ipython-input-141-ad9610064de4> in <module>() ----> 1 nom.geocode('revontulentie 11')  /users/nmbqz/.virtualenvs/scrapy/lib/python3.5/site-packages/geopy/geocoders/osm.py in geocode(self, query, exactly_one, timeout, addressdetails, language, geometry)     191         logger.debug("%s.geocode: %s", self.__class__.__name__, url)     192         return self._parse_json( --> 193             self._call_geocoder(url, timeout=timeout), exactly_one     194         )     195   /users/nmbqz/.virtualenvs/scrapy/lib/python3.5/site-packages/geopy/geocoders/base.py in _call_geocoder(self, url, timeout, raw, requester, deserializer, **kwargs)     169                 if "timed out" in message:     170                     raise geocodertimedout('service timed out') --> 171             raise geocoderserviceerror(message)     172      173         if hasattr(page, 'getcode'):  geocoderserviceerror: [errno 8] nodename nor servname provided, or not known 

appreciate clues!

try removing http:// url , adding scheme parameter. in case

nom=nominatim(domain='localhost:8080', scheme='http') 

this due following part in source code

self.domain = domain.strip('/') self.api = "%s://%s/search" % (self.scheme, self.domain) 

where self.scheme set https default


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -