Inist-CNRS / web-services

Web services at Inist-CNRS
https://services.istex.fr
5 stars 0 forks source link

[address-kit] affilcountry does not work in v2.1.2 #114

Closed parmentf closed 3 months ago

parmentf commented 3 months ago

Reproduce:

npm run test:remote address-kit

Here is the log:

Traceback (most recent call last):
  File "/app/public/./v1/affiliationcountry/detect_country.py", line 94, in <module>
    country=countries.get(ars[-1].strip()).name
  File "/usr/local/lib/python3.9/site-packages/iso3166/__init__.py", line 505, in get
    raise KeyError(key)
KeyError: 'centre de recherches sur la géologie des matières premières minérales et énergétiques cregu université de lorraine ul centre national de la recherche scientifique'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/public/./v1/affiliationcountry/detect_country.py", line 109, in <module>
    country=placeaddress(a)[0]
  File "/app/public/./v1/affiliationcountry/detect_country.py", line 48, in placeaddress
    place, (lat, lng)=locator(address)
TypeError: cannot unpack non-iterable NoneType object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/usr/local/lib/python3.9/http/client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/usr/local/lib/python3.9/ssl.py", line 501, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.9/ssl.py", line 1074, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.9/ssl.py", line 1343, in do_handshake
    self._sslobj.do_handshake()
socket.timeout: _ssl.c:1112: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/geopy/geocoders/base.py", line 355, in _call_geocoder
    page = requester(req, timeout=timeout, **kwargs)
  File "/usr/local/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/local/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error _ssl.c:1112: The handshake operation timed out>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/public/./v1/affiliationcountry/detect_country.py", line 216, in <module>
    country=placeaddress(aa)[0]
  File "/app/public/./v1/affiliationcountry/detect_country.py", line 48, in placeaddress
    place, (lat, lng)=locator(address)
  File "/usr/local/lib/python3.9/site-packages/geopy/geocoders/osm.py", line 387, in geocode
    self._call_geocoder(url, timeout=timeout), exactly_one
  File "/usr/local/lib/python3.9/site-packages/geopy/geocoders/base.py", line 378, in _call_geocoder
    raise GeocoderTimedOut('Service timed out')
geopy.exc.GeocoderTimedOut: Service timed out

The previous version (2.1.1) still works:

$ npx hurl --test --variable host="http://192.168.128.151:49272" "services/address-kit/tests.hurl" 
services/address-kit/tests.hurl: Running [1/1]
services/address-kit/tests.hurl: Success (2 request(s) in 11357 ms)
--------------------------------------------------------------------------------
Executed files:  1
Succeeded files: 1 (100.0%)
Failed files:    0 (0.0%)
Duration:        11358 ms
parmentf commented 3 months ago

After testing again, it works:

npm run test:remote address-kit

> web-services@1.0.0 test:remote
> bin/test-service.sh remote address-kit

services/address-kit/tests.hurl: Running [1/1]
services/address-kit/tests.hurl: Success (2 request(s) in 8790 ms)
--------------------------------------------------------------------------------
Executed files:  1
Succeeded files: 1 (100.0%)
Failed files:    0 (0.0%)
Duration:        8793 ms