MicroPyramid / forex-python

Foreign exchange rates, Bitcoin price index and currency conversion using ratesapi.io
http://forex-python.readthedocs.io/en/latest/usage.html
MIT License
662 stars 197 forks source link

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091) #101

Closed karl0ss closed 3 years ago

karl0ss commented 3 years ago

Using the python forex package, and my service keeps randomly dying with

Traceback (most recent call last):
  File "/home/ec2-user/BTB-manager-telegram/btb_manager_telegram/buttons.py", line 232, in check_progress
    custom = c.get_rate('USD', custom_currency)
  File "/home/ec2-user/BTB-manager-telegram/venv/lib64/python3.7/site-packages/forex_python/converter.py", line 72, in get_rate
    response = requests.get(source_url, params=payload)
  File "/home/ec2-user/BTB-manager-telegram/venv/lib64/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/home/ec2-user/BTB-manager-telegram/venv/lib64/python3.7/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/ec2-user/BTB-manager-telegram/venv/lib64/python3.7/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/ec2-user/BTB-manager-telegram/venv/lib64/python3.7/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/home/ec2-user/BTB-manager-telegram/venv/lib64/python3.7/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='theforexapi.com', port=443): Max retries exceeded with url: /api/latest?base=USD&symbols=GBP&rtype=fpy (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)')))

No issues hitting the url via chrome, restarting my app doesn't seem to fix the problem, but at somepoint, it seemed to start working again, but has again, stopped this morning, any ideas?