Skip to content

Commit 21da2d8

Browse files
committed
made a bit more generic
1 parent 5413b4b commit 21da2d8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

notifications/opm_smshandler.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import httplib, urllib, _mysql
22

33
def sendsms( msg, cellno ):
4-
params = urllib.urlencode({'username': 'tomvdb', 'password': 'h4h123', 'message': msg, 'msisdn': cellno })
4+
# replace username and password with your own bulksms credentials
5+
params = urllib.urlencode({'username': 'username', 'password': 'password', 'message': msg, 'msisdn': cellno })
56
headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
67
conn = httplib.HTTPConnection("bulksms.2way.co.za:5567")
78
conn.request("POST", "/eapi/submission/send_sms/2/2.0", params, headers)
@@ -12,15 +13,16 @@ def sendsms( msg, cellno ):
1213

1314
# connect to db
1415

15-
#sendsms( "Helo WOrld!", "27835004113")
16-
db = _mysql.connect(host="178.79.191.73",port=3306,user="beowulf",passwd="grindel",db="opm")
16+
# replaces these non-working usernames and passwords with your own account
17+
db = _mysql.connect(host="host",port=3306,user="user",passwd="password",db="opm")
1718
db.query("""select queue.id,pumps.name,contacts.number, status.voltage, queue.status from queue,pumps,contacts, status where queue.sent=0 and pumps.id=queue.pump and contacts.id=queue.contact and status.pump = pumps.id""")
1819
r=db.use_result()
1920

2021
data = r.fetch_row()
2122
status = []
2223

23-
updateStatus = _mysql.connect(host="178.79.191.73",port=3306,user="beowulf",passwd="grindel",db="opm")
24+
# replace the info with your own
25+
updateStatus = _mysql.connect(host="host",port=3306,user="user",passwd="password",db="opm")
2426

2527
while len(data) > 0:
2628
# print data

0 commit comments

Comments
 (0)