diff options
| author | 2019-11-26 13:41:40 +0000 | |
|---|---|---|
| committer | 2019-11-26 13:42:01 +0000 | |
| commit | 2d21dfa22931bdb887ccccba4a33e6fa4755e94b (patch) | |
| tree | 6ef5e304e3e9a69f9afd66ac0bee4d98ec115399 /modules/bitcoin.py | |
| parent | remove all `eagle` stuff from nr.py (diff) | |
| signature | ||
utils.http.Response.data should always be `bytes` - add .decode and .soup
Diffstat (limited to 'modules/bitcoin.py')
| -rw-r--r-- | modules/bitcoin.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/modules/bitcoin.py b/modules/bitcoin.py index 91fd84fb..c130d20d 100644 --- a/modules/bitcoin.py +++ b/modules/bitcoin.py @@ -12,16 +12,15 @@ class Module(ModuleManager.BaseModule): :usage: [currency] """ currency = (event["args"] or "USD").upper() - page = utils.http.request("https://blockchain.info/ticker", - json=True) + page = utils.http.request("https://blockchain.info/ticker").json() if page: - if currency in page.data: - conversion = page.data[currency] + if currency in page: + conversion = page[currency] buy, sell = conversion["buy"], conversion["sell"] event["stdout"].write("1 BTC = %.2f %s (buy) %.2f %s " "(sell)" % (buy, currency, sell, currency)) else: event["stderr"].write("Unknown currency, available " - "currencies: %s" % ", ".join(page.data.keys())) + "currencies: %s" % ", ".join(page.keys())) else: raise utils.EventResultsError() |
