Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError "rates" when running make serve on latest master #735

Closed
almet opened this issue Apr 7, 2021 · 2 comments · Fixed by #736
Closed

KeyError "rates" when running make serve on latest master #735

almet opened this issue Apr 7, 2021 · 2 comments · Fixed by #736

Comments

@almet
Copy link
Member

almet commented Apr 7, 2021

After a fresh install, it seems that the currency convertor isn't up to date with the returned JSON from their API.

See the traceback.

Traceback (most recent call last):
  File "/home/alexis/ihatemoney/.venv/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/alexis/ihatemoney/.venv/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/alexis/ihatemoney/.venv/lib/python3.7/site-packages/flask_restful/__init__.py", line 272, in error_router
    return original_handler(e)
  File "/home/alexis/ihatemoney/.venv/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/alexis/ihatemoney/.venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/alexis/ihatemoney/.venv/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/alexis/ihatemoney/.venv/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/alexis/ihatemoney/ihatemoney/web.py", line 256, in home
    project_form = ProjectForm()
  File "/home/alexis/ihatemoney/.venv/lib/python3.7/site-packages/wtforms/form.py", line 212, in __call__
    return type.__call__(cls, *args, **kwargs)
  File "/home/alexis/ihatemoney/ihatemoney/forms.py", line 116, in __init__
    for currency_name in self.currency_helper.get_currencies()
  File "/home/alexis/ihatemoney/ihatemoney/currency_convertor.py", line 31, in get_currencies
    for rate in self.get_rates()
  File "/home/alexis/ihatemoney/.venv/lib/python3.7/site-packages/cachetools/decorators.py", line 22, in wrapper
    v = func(*args, **kwargs)
  File "/home/alexis/ihatemoney/ihatemoney/currency_convertor.py", line 24, in get_rates
    rates = requests.get(self.api_url).json()["rates"]
KeyError: 'rates'
@almet
Copy link
Member Author

almet commented Apr 7, 2021

It seems to be because I don't have an API key for their service.

{'success': False, 'error': {'code': 101, 'type': 'missing_access_key', 'info': 'You have not supplied an API Access Key. [Required format: access_key=YOUR_ACCESS_KEY]'}}

@almet
Copy link
Member Author

almet commented Apr 7, 2021

Seems related to exchangeratesapi/exchangeratesapi#117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant