Print the current status of of you account for the deepbit.net miner pool using Python.
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
#!/usr/bin/env python | |
import json, urllib | |
API_KEY='4e088145797261e10a000000_DA858CAE16' | |
API_BASE = 'http://deepbit.net/api/' | |
class Deepbit(object): | |
@staticmethod | |
def get_stats(api_key): | |
url = API_BASE + api_key | |
try: | |
result = json.load(urllib.urlopen(url)) | |
except: | |
# An error occurred; raise an exception | |
raise NameError('Could not get the data, sorry. Maybe a non-functional internet connection or wrong API key?') | |
return result | |
try: | |
print json.dumps(Deepbit.get_stats(API_KEY), indent=2) | |
except Exception as e: | |
print e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks. works just fine.