1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2025-04-21 12:27:27 +03:00

new pakcage: icarus python miner software

This commit is contained in:
Xiangfu Liu
2012-02-09 11:14:14 +08:00
parent cc8b88b103
commit f8417fdf94
160 changed files with 25478 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env python
import json, urllib
from optparse import OptionParser
class Deepbit(object):
@staticmethod
def get_stats(url):
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:
parser = OptionParser()
parser.add_option("-a",
"--api-key",
dest="api",
default="http://deepbit.net/api/4edf2d91069172fdae000000_DE38384EE2",
help="JSON API key")
(options, args) = parser.parse_args()
print json.dumps(Deepbit.get_stats(options.api), indent=2)
except Exception as e:
print e