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

Exchangerates-API requieres access key #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ebnermic
Copy link

@ebnermic ebnermic commented Apr 6, 2021

Exchangrerates API requieres an access key to work. It does not work anymore since 01.04.2021 without this key.

The README has been enhanced as well to show the users how to implement and test it.

Description of change

  • Changed the base url to "HTTP" instead of "HTTPS" as the lowest plan (Free plan) from exchangeratesapi.io only provieds "HTTP"
  • Added access_key as parameter in do_sync and used this parameter in the request method
  • Added payload logging to be able to trace the responses and understand what has been done
  • Read access_key from config file and pass it as parameter in do_sync call

Manual QA steps

  • Tested locally

Risks

  • Error while executing without api_key but users without the API key will not be able to run this tap anyway.

Rollback steps

  • revert this branch

…fig sample and the code has been adapted to use the access key in the request url as an additional parameter.

The README has been enhanced as well to show the users how to implement and test it.
@cmerrick
Copy link
Contributor

cmerrick commented Apr 6, 2021

Hi @ebnermic, thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes.

@cmerrick
Copy link
Contributor

cmerrick commented Apr 6, 2021

You did it @ebnermic!

Thank you for signing the Singer Contribution License Agreement.

@RuslanBergenov
Copy link

@ebnermic, thanks for looking into this issue. I I just tested your master branch and got this error:

INFO Replicating exchange rate data from 2021-05-01 using base CAD
INFO {'success': False, 'error': {'code': 105, 'type': 'base_currency_access_restricted'}}
Traceback (most recent call last):
  File "{my_dir}/virtualenv_exchangerates/bin/tap-exchangeratesapi", line 11, in <module>
    load_entry_point('tap-exchangeratesapi==0.1.1', 'console_scripts', 'tap-exchangeratesapi')()
  File "{my_dir}/virtualenv_exchangerates/lib/python3.7/site-packages/tap_exchangeratesapi/
__init__.py", line 118, in main
    do_sync(config.get('base', 'USD'), start_date, access_key)
  File "{my_dir}/virtualenv_exchangerates/lib/python3.7/site-packages/tap_exchangeratesapi/
__init__.py", line 66, in do_sync
    for rate in payload['rates']:
KeyError: 'rates'

my tap-config is:
{ "base": "CAD",
"start_date": "2021-05-01",
"access_key": "{my_key}"
}

@ebnermic
Copy link
Author

@RuslanBergenov this error is right. As you only have the free plan, your api key does not support any other base currency. The base currency for the free plan is EUR. On the pricing page you can see, that only "basic" and above plans get you "source currency switching"
https://exchangeratesapi.io/pricing/

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 this pull request may close these issues.

3 participants