alexprengere / currencyconverter

A Python currency converter using the European Central Bank data.
http://alexprengere.github.io/currencyconverter
Apache License 2.0
215 stars 59 forks source link

CurrencyConverter creation sometimes fails when creating with up to date full history url #26

Closed amirs-kov closed 3 years ago

amirs-kov commented 3 years ago

When creating the CurrencyConverter using the file with the full history ('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip'), the currency converter often fails on URLError. This is not consistent as it doesn't always fail.

  1. We've been using the currencyconverter for a year or so but it only started happening recently.

  2. We're using the latest version (0.14.4).

  3. Full traceback: self.currency_converter: CurrencyConverter = CurrencyConverter(CURRENCY_UP_TO_DATE_PATH, fallback_on_missing_rate=True) File "/usr/local/lib/python3.8/site-packages/currency_converter/currency_converter.py", line 154, in init self.load_file(currency_file) File "/usr/local/lib/python3.8/site-packages/currency_converter/currency_converter.py", line 160, in load_file content = urlopen(currency_file).read() File "/usr/local/lib/python3.8/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/usr/local/lib/python3.8/urllib/request.py", line 525, in open response = self._open(req, data) File "/usr/local/lib/python3.8/urllib/request.py", line 542, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(*args) File "/usr/local/lib/python3.8/urllib/request.py", line 1379, in http_open return self.do_open(http.client.HTTPConnection, req) File "/usr/local/lib/python3.8/urllib/request.py", line 1353, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>