Last active
March 26, 2016 17:06
-
-
Save Aareon/a7f264d01d8321729e63 to your computer and use it in GitHub Desktop.
Needs parse.py, found in source.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##parse.py - https://gist.github.com/Aareon/95118516b7db4f88939c | |
import urllib2, json, re | |
from util.parse import parse_json | |
api_url = "http://corgex.corgicoin.co.uk/api_fetch.php?method=" | |
def api_info(): | |
response = urllib2.urlopen(api_url+"getinfo") | |
page = response.read() | |
getinfo = json.loads(page) | |
if getinfo["status"] == 1: | |
print(getinfo) | |
block_height = str(getinfo["data"]["blocks"]) | |
pow_diff = getinfo["data"]["difficulty"]["proof-of-work"] | |
pos_diff = getinfo["data"]["difficulty"]["proof-of-stake"] | |
money_supply = getinfo["data"]["moneysupply"] | |
connections = str(getinfo["data"]["connections"]) | |
api_info.api_output = ("Coin: {blue}CORG {black}| Height: {blue}"+block_height+ | |
"{black} | POW Diff: {blue}"+pow_diff+"{black} | POS Diff: {blue}"+pos_diff+ | |
"{black} | Money Supply: {blue}"+money_supply+"{black} | Connections: {blue}"+ | |
connections+"{black}.") | |
return() | |
else: | |
api_info.api_output = "A connection to the explorer could not be established." | |
return() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment