-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgvaddnote.py
58 lines (53 loc) · 1.11 KB
/
gvaddnote.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
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
from sys import exit, argv
from googlevoice import Voice
import json
voice = Voice()
try:
email = argv[1]
except:
print ('Error! Please provide Email Account. ')
exit(0)
try:
password = argv[2]
except:
print ('Error! Please provide Passsword. ')
exit(0)
try:
voice.login(email,password)
except:
print ('Error! Login failed. ')
exit(0)
try:
msgfolder = argv[3]
except:
print ('Error! Please provide a Message Folder an Message ID and NOTES. ')
voice.logout()
exit(0)
try:
ID = argv[4]
except:
print ('Error! Please provide a Message ID and NOTES. ')
voice.logout()
exit(0)
try:
NOTES = json.loads(argv[5])
except:
print ('Error! Please provide NOTES. ')
voice.logout()
exit(0)
try:
if msgfolder == "Voicemail" :
for message in voice.voicemail().messages:
if (message.id == ID) :
message.addNote(NOTES)
break
elif msgfolder == "Recorded" :
for message in voice.recorded().messages:
if (message.id == ID) :
message.addNote(NOTES)
break
except:
print ("Error! With" + msgfolder + ", Message ID:" + ID + " and Notes:" + NOTES )
print "Notes Added!"
voice.logout()