Skip to content

Instantly share code, notes, and snippets.

@alanzchen
Created January 17, 2018 08:53
Show Gist options
  • Save alanzchen/a234919ef5a01f2d05950b40ac42f975 to your computer and use it in GitHub Desktop.
Save alanzchen/a234919ef5a01f2d05950b40ac42f975 to your computer and use it in GitHub Desktop.
A Nicehash worker monitor plugin for BitBar.
#!/usr/bin/python
# coding=utf-8
"""
# <bitbar.title>Nicehash Stats</bitbar.title>
# <bitbar.version>v1</bitbar.version>
# <bitbar.author>alan</bitbar.author>
# <bitbar.author.github>alanzchen</bitbar.author.github>
# <bitbar.desc>
# Displays current Nicehash Worker Stats
# </bitbar.desc>
"""
import requests
a = requests.get('https://api.nicehash.com/api?method=simplemultialgo.info').json()
m = {str(i['algo']): i['name'] for i in a['result']["simplemultialgo"]}
r = requests.get(
url="https://api.nicehash.com/api",
params={
"method": "stats.provider",
"addr": "<YOUR ADDR HERE>",
}
).json()
for i in r['result']['stats']:
if float(i['accepted_speed']) > 0:
print m[str(i['algo'])] + ': ' + str(round(float(i['accepted_speed']), 3))
print('---')
print('Refresh | refresh=true')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment