-
Notifications
You must be signed in to change notification settings - Fork 0
/
zec_balances.py
38 lines (31 loc) · 1.48 KB
/
zec_balances.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import requests
import time
import sys
import smtplib
from email.mime.text import MIMEText
headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'}
_user = "[email protected]"
_pwd = ""
_to = "[email protected]"
msg = MIMEText("At least one worker crashed!")
msg["Subject"] = "Miner Alarm"
msg["From"] = _user
msg["To"] = _to
while(True):
result = requests.get("http://zcash.flypool.org/api/miner_new/t1bqmB9MzbeUkqVZMJtvur5PY22QozvKyZk",headers=headers)
PC163 = result.json()["workers"]['littercap@163']
PCP40 = result.json()["workers"]['littercap@P40']
PC163time = time.localtime(PC163['workerLastSubmitTime'])
PCP40time = time.localtime(PCP40['workerLastSubmitTime'])
print('PC163:'+'\t'+'HashRate:'+PC163['hashrate']+'\t'+'ValidShare:'+str(PC163['validShares'])+'\t'+'LastSubmit:'+time.strftime(" %m-%d %H:%M:%S", PC163time)+'\r')
print('PCP40:'+'\t'+'HashRate:'+PCP40['hashrate']+'\t'+'ValidShare:'+str(PCP40['validShares'])+'\t'+'LastSubmit:'+time.strftime(" %m-%d %H:%M:%S", PCP40time)+'\r')
if PC163['validShares'] == 0 or PCP40['validShares'] == 0:
print("One Worker Sucks!", '\n')
mail = smtplib.SMTP_SSL("smtp.qq.com", 465)
mail.login(_user, _pwd)
mail.sendmail(_user, _to, msg.as_string())
mail.quit()
break
for i in range(600):
sys.stdout.writelines(time.asctime(time.localtime()) + '\r')
time.sleep(1)