-
Notifications
You must be signed in to change notification settings - Fork 0
/
LTCSMS_10_17_2013.py
40 lines (33 loc) · 1.24 KB
/
LTCSMS_10_17_2013.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
39
40
#!/usr/bin/python
from json import json
from urllib2 impor urlopen
from requests import get
from smtplib import SMTP
import datetime
# Personal Data
address = ''
phoneService = ''
phoneNumber = ''
gmail_user = ''
gmail_pwd = ''
date = str(datetime.datetime.now().date())
# Pool-x.eu API here
poolData = json.load(urllib2.urlopen('http://pool-x.eu/api?api_key=fdc5f01a60fff78ef4191f6caee221556dd69ad1a58be4594e1457e288f39b33'))
confirmed_rewards = str(float(poolData['confirmed_rewards']))
# Blockchain Explorer API here
receivedRaw = requests.get('http://explorer.litecoin.net/chain/Litecoin/q/getreceivedbyaddress/' + address)
sentRaw = requests.get('http://explorer.litecoin.net/chain/Litecoin/q/getsentbyaddress/' + address)
received = float(receivedRaw.text)
sent = float(sentRaw.text)
walletBalance = str(received - sent)
# Message here
to = phoneNumber+'@messaging.sprintpcs.com'
smtpserver = smtplib.SMTP("smtp.gmail.com",587)
smtpserver.starttls()
smtpserver.login(gmail_user, gmail_pwd)
header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n'
msg = header + '\n Wallet says: ' + walletBalance + '.\n Mining says: ' + confirmed_rewards + '\n Date: ' + date + '.\n'
print msg
smtpserver.sendmail(gmail_user, to, msg)
print 'Message sent!'
smtpserver.close()