diff options
| author | 2018-12-11 22:26:38 +0000 | |
|---|---|---|
| committer | 2018-12-11 22:26:38 +0000 | |
| commit | 793d234a0b924c0330e88f07f68b13559b42e4ac (patch) | |
| tree | 90ecd3746a77e17da915f90ec057cb16ead82c05 /modules/bitcoin.py | |
| parent | Actually use `action_desc` in github.py.issues, so that we can see what things (diff) | |
| signature | ||
'utils.http.get_url' -> 'utils.http.request', return a Response object from
utils.http.request
Diffstat (limited to 'modules/bitcoin.py')
| -rw-r--r-- | modules/bitcoin.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/bitcoin.py b/modules/bitcoin.py index 29c2fcd7..2d409a3f 100644 --- a/modules/bitcoin.py +++ b/modules/bitcoin.py @@ -10,16 +10,16 @@ class Module(ModuleManager.BaseModule): :usage: [currency] """ currency = (event["args"] or "USD").upper() - page = utils.http.get_url("https://blockchain.info/ticker", + page = utils.http.request("https://blockchain.info/ticker", json=True) if page: - if currency in page: - conversion = page[currency] + if currency in page.data: + conversion = page.data[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.keys())) + "currencies: %s" % ", ".join(page.data.keys())) else: raise utils.EventsResultsError() |
