I am having certificate error in python code as below run in docker container laudio/pyodbc
File "/usr/local/lib/python3.7/site-packages/fredapi/fred.py", line 131, in get_series
root = self.__fetch_data(url)
File "/usr/local/lib/python3.7/site-packages/fredapi/fred.py", line 64, in __fetch_data
response = urlopen(url)
File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.7/urllib/request.py", line 1362, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/local/lib/python3.7/urllib/request.py", line 1321, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)>
my certificates are up to date
root@8a03fe8175b7:/# pip install --upgrade certifi
Requirement already up-to-date: certifi in /usr/local/lib/python3.7/site-packages (2020.4.5.1)
I have also tried to use no_ssl_verification solution that didn't help.
Also, this file is empty, does this mean anything? On my host machine it is full
root@2927b5836cfa:/# ls -alt /etc/ssl/certs/ca-certificates.crt
-rw-r--r-- 1 root root 0 May 23 20:14 /etc/ssl/certs/ca-certificates.crt
Further info from the python shell in container, I don't know if that helps. But there is no /export directory in the container:
print(ssl.get_default_verify_paths())
DefaultVerifyPaths(cafile=None, capath=None, openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/export/home/pb2/build/sb_0-35870562-1568195162.53/openssl-1.1.1d-el6-x86-64bit/ssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/export/home/pb2/build/sb_0-35870562-1568195162.53/openssl-1.1.1d-el6-x86-64bit/ssl/certs')
Can you please provide me some ideas to fix this issue?