Skip to content

Commit

Permalink
currency: replace exchangerate.host -> open.er-api.com
Browse files Browse the repository at this point in the history
exchangerate.host was bought and changed to require an API key. The new
owner also allegedly broke compatibility with the original endpoints,
based on GitHub comments from other developers, so I didn't even bother
signing up for a key and testing it. I just found a new keyless API.

ExchangeRate-API.com also provides key-based services, but there's an
open endpoint that doesn't require any key we can use for now.

VCR file for `currency` example test has been updated, as well.

Note that this will be a "breaking" change for users who specify the
`currency.fiat_provider` option in their settings as `exchangerate.host`
since that's no longer a valid value. (Ask me how I know... I forgot to
update the default at first and the test suite failed because of it. :D)
  • Loading branch information
dgw committed Oct 1, 2023
1 parent 03dd79b commit d4686ff
Show file tree
Hide file tree
Showing 3 changed files with 661 additions and 115 deletions.
4 changes: 2 additions & 2 deletions sopel/modules/currency.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

PLUGIN_OUTPUT_PREFIX = '[currency] '
FIAT_PROVIDERS = {
'exchangerate.host': 'https://api.exchangerate.host/latest?base=EUR',
'open.er-api.com': 'https://open.er-api.com/v6/latest/EUR',
'fixer.io': '//data.fixer.io/api/latest?base=EUR&access_key={}',
}
CRYPTO_URL = 'https://api.coingecko.com/api/v3/exchange_rates'
Expand All @@ -43,7 +43,7 @@ class CurrencySection(types.StaticSection):
fiat_provider = types.ChoiceAttribute(
'fiat_provider',
list(FIAT_PROVIDERS.keys()),
default='exchangerate.host',
default='open.er-api.com',
)
"""Which data provider to use (some of which require no API key)"""
fixer_io_key = types.ValidatedAttribute('fixer_io_key', default=None)
Expand Down
Loading

0 comments on commit d4686ff

Please sign in to comment.