From 8457c3530435d3c27d1be9d9306b56e4629f5190 Mon Sep 17 00:00:00 2001 From: donkeydonkey Date: Tue, 30 Mar 2021 10:41:48 -0700 Subject: [PATCH] redo lastblock with jsonrpc post method --- network.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/network.py b/network.py index d0c776b..8fcb889 100644 --- a/network.py +++ b/network.py @@ -7,7 +7,12 @@ import re # networkurl = "http://opennode.minemonero.pro:18081/getinfo" # networkurl = "http://node.xmr.pt:18081/getinfo" networkurl = "http://node.supportxmr.com:18081/getinfo" -lastblock = "http://node.supportxmr.com:18081/get_last_block_header" + +jsonurl = "http://node.supportxmr.com:18081/json_rpc" +headers = { + 'Content-Type': 'application/json', +} +requestdata = '{"jsonrpc":"2.0","id":"0","method":"get_last_block_header"}' @sopel.module.commands('fork', 'forkening') def fork(bot, trigger): @@ -63,8 +68,10 @@ def mempool(bot, trigger): def lastblock(bot, trigger): try: r=requests.get(lastblock) + r=requests.post(jsonurl, headers=headers, data=requestdata) j=r.json() - bot.say("The current number of txs in Monero's Last Block is {0}".format(j['block_header']['num_txes'])) + block=j['result']['block_header'] + bot.say("Last block height is {0} with {1} transactions".format(block['height'],block['num_txes'])) except: bot.say("Something borked o_O")