Skip to content

Instantly share code, notes, and snippets.

@pklaus
Created June 24, 2011 19:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pklaus/1045471 to your computer and use it in GitHub Desktop.
Save pklaus/1045471 to your computer and use it in GitHub Desktop.
Print the current status of of you account for the deepbit.net miner pool using Python.
#!/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
@xiangfu
Copy link

xiangfu commented Jan 18, 2012

thanks. works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment