pcubillos / bibmanager

A BibTeX manager for LaTeX projects

Home Page:https://bibmanager.rtfd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ADS queries fail with SSL: CERTIFICATE_VERIFY_FAILED

pcubillos opened this issue · comments

It might be a change in the query format from ADS??
Here's how it breaks:

bibm ads-search
(Press 'tab' for autocomplete)
author:"^cubillos" property:refereed

Traceback (most recent call last):
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/urllib3/connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 501, in wrap_socket
    return self.sslsocket_class._create(
  File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1041, in _create
    self.do_handshake()
  File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1310, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.adsabs.harvard.edu', port=443): Max retries exceeded with url: /v1/search/query?q=author%3A%22%5Ecubillos%22%20property%3Arefereed&start=0&rows=200&sort=pubdate+desc&fl=title,author,year,bibcode,pub (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/pato/envs/py39/bin/bibm", line 33, in <module>
    sys.exit(load_entry_point('bibmanager', 'console_scripts', 'bibm')())
  File "/Users/pato/Dropbox/IWF/projects/2018_bibmanager/bibmanager/bibmanager/__main__.py", line 1266, in main
    args.func(args)
  File "/Users/pato/Dropbox/IWF/projects/2018_bibmanager/bibmanager/bibmanager/__main__.py", line 284, in cli_ads_search
    am.manager(query)
  File "/Users/pato/Dropbox/IWF/projects/2018_bibmanager/bibmanager/bibmanager/ads_manager/ads_manager.py", line 51, in manager
    results, nmatch = search(query, start=start)
  File "/Users/pato/Dropbox/IWF/projects/2018_bibmanager/bibmanager/bibmanager/ads_manager/ads_manager.py", line 121, in search
    r = requests.get(
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/Users/pato/envs/py39/lib/python3.9/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.adsabs.harvard.edu', port=443): Max retries exceeded with url: /v1/search/query?q=author%3A%22%5Ecubillos%22%20property%3Arefereed&start=0&rows=200&sort=pubdate+desc&fl=title,author,year,bibcode,pub (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))

Seems that the issue originated from ADS. The error no longer occurs.