-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmasstxt.py
45 lines (39 loc) · 1.38 KB
/
masstxt.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
41
42
43
44
45
#!/usr/bin/python
from googlevoice import Voice
from googlevoice.util import input
import commands
import sys
import base64 as b64 #Only used if you encode your password to keep from casual perusal
import csv
##########
#Program expects two arguments
#1st argument - Message to send (must be in quotes to capture whitespace)
#2nd argument -(OPTIONAL) Path to comma separated file of phone numbers to send to
##########
voice = Voice()
password = b64.b64decode('ENCODED GV PASS')
user = b64.b64decode('ENCODED GV USR')
voice.login(user, password)
phoneNumber = '123-456-7890' #(cell number associated with GV account)
#second argument to program is path to a CSV of phone numbers
try:
textReader = csv.reader(open(sys.argv[2],'rb'), delimiter=',')
except IndexError:
#if there is no argument, use hardcoded path
textReader = csv.reader(open('/PATH/TO/PARTY/LIST/party_txt_list.txt','rb'), delimiter=',')
#change the above path to a file containing phone numbers separated by commas
text_list = textReader.next()
def massTXT():
#mass is a string prepended to the text to indicate it is a group message
#leave blank for no prepended text
mass = "massTXT:"
try:
#program expects text to be first commandline argument to program
text = sys.argv[1]
except IndexError:
print "Need message"
exit()
for each in text_list:
voice.send_sms(each, mass + text)
if __name__ == '__main__':
massTXT()