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

The tap fails with KeyError: 'rates' #13

Open
daigotanaka opened this issue Apr 6, 2021 · 7 comments
Open

The tap fails with KeyError: 'rates' #13

daigotanaka opened this issue Apr 6, 2021 · 7 comments

Comments

@daigotanaka
Copy link

daigotanaka commented Apr 6, 2021

OS: Ubuntu 18.04.2 LTS
Python: Python 3.6.9

How to reproduce:

$ python3 -m venv venv

$ . venv/bin/activate

$ pip install tap-exchangeratesapi
Collecting tap-exchangeratesapi
  Cache entry deserialization failed, entry ignored
.
.
.
Collecting six>=1.5 (from python-dateutil>=2.6.0->singer-python==5.3.3->tap-exchangeratesapi)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Installing collected packages: idna, certifi, chardet, urllib3, requests, backoff, jsonschema, pytz, six, python-dateutil, simplejson, singer-python, tap-exchangeratesapi
Successfully installed backoff-1.3.2 certifi-2020.12.5 chardet-3.0.4 idna-2.8 jsonschema-2.6.0 python-dateutil-2.8.1 pytz-2018.4 requests-2.21.0 simplejson-3.11.1 singer-python-5.3.3 six-1.15.0 tap-exchangeratesapi-0.1.1 urllib3-1.24.3

$ tap-exchangeratesapi
INFO Replicating exchange rate data from 2021-04-06 using base USD
Traceback (most recent call last):
  File "/home/ubuntu/project/venv/bin/tap-exchangeratesapi", line 11, in <module>
    sys.exit(main())
  File "/home/ubuntu/project/venv/lib/python3.6/site-packages/tap_exchangeratesapi/__init__.py", line 115, in main
    do_sync(config.get('base', 'USD'), start_date)
  File "/home/ubuntu/project/venv/lib/python3.6/site-packages/tap_exchangeratesapi/__init__.py", line 64, in do_sync
    for rate in payload['rates']:
KeyError: 'rates'
@daigotanaka
Copy link
Author

daigotanaka commented Apr 6, 2021

The same result with config file:

$ echo '{ "base": "USD", "start_date": "2021-04-01" }' > config.json
$ tap-exchangeratesapi -c config.json 
INFO Replicating exchange rate data from 2021-04-01 using base USD
Traceback (most recent call last):
  File "/home/ubuntu/project/venv/bin/tap-exchangeratesapi", line 11, in <module>
    sys.exit(main())
  File "/home/ubuntu/project/venv/lib/python3.6/site-packages/tap_exchangeratesapi/__init__.py", line 115, in main
    do_sync(config.get('base', 'USD'), start_date)
  File "/home/ubuntu/project/venv/lib/python3.6/site-packages/tap_exchangeratesapi/__init__.py", line 64, in do_sync
    for rate in payload['rates']:
KeyError: 'rates'

@daigotanaka
Copy link
Author

I console-out the response object. Now api.exchangeratesapi.io seems to require an access key:

{'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]'}}

@daigotanaka
Copy link
Author

The basic service is still free but it requires a signup and access key:
https://exchangeratesapi.io/

I think the tap needs to be modified to include the key in the config & request.

@daigotanaka
Copy link
Author

Related thread: exchangeratesapi/exchangeratesapi#117

@daigotanaka
Copy link
Author

Another option is to switch to https://exchangerate.host (no key required, basically the same format as exchangeratesapi.io)

According to: exchangeratesapi/exchangeratesapi#117 (comment)

@daigotanaka
Copy link
Author

Looks like there is a PR already: #12

@daigotanaka
Copy link
Author

FYI: For the people interested in no sign up option via exchangerate.host, I created https://github.com/anelendata/tap-exchangeratehost

rx added a commit to evvnt/docker-singer-exchangerateapi that referenced this issue May 16, 2022
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

No branches or pull requests

1 participant