1 """
2 A module that can send text (SMS) messages to any phone number.
3
4 Currently, this module requires a Google Voice account and depends on
5 pygooglevoice to access your Google Voice account.
6
7 You can sign up for a Google Voice account at http://voice.google.com
8
9 pygooglevoice is in PyPI but unfortunately is not configured properly. You'll
10 have to download the source and run::
11
12 sudo python2 setup.py install
13
14 in the directory containing setup.py. You can download pygooglevoice at
15 http://code.google.com/p/pygooglevoice/downloads/list
16
17 There are other ways to send SMS messages, so this module is designed such that
18 other methods could be added. (For instance, using an SMTP server to send
19 emails to addresses like '0001112222@vtext.com'.) Namely, functions specific
20 to Google Voice are prefixed with '_gv'.
21 """
22 import googlevoice
23
24 _voice = None
25 """Store the pygooglevoice.Voice instance."""
26
27
29 """
30 Logs into to your Google Voice account with your full email address
31 (i.e., 'something@gmail.com') and password. This MUST be called before
32 using send. login only needs to be called once per program execution.
33
34 Note that your Google Voice login information is probably the same as your
35 gmail login information. Please be careful with your login credentials!
36 (It is not a bad idea to setup an entirely separate Google Voice account
37 just for sending SMS.)
38 """
39 _gv_login(email, passwd)
40
41
42 -def send(phone_number, msg):
43 """
44 Sends an SMS message to phone_number (which should be a string) with
45 a message containing msg.
46
47 login MUST be called before send can be called. login only
48 needs to be called once per program execution.
49
50 Note that these are SMS messages, and each SMS message is limited to
51 160 characters. If msg is longer than that, it will be broken up into
52 multiple SMS messages.
53 """
54 _gv_send(phone_number, msg)
55
56
58 """
59 Logs into to your Google Voice account with your full email address
60 (i.e., 'something@gmail.com') and password. This MUST be called before
61 using _gv_send. _gv_login only needs to be called once per program
62 execution.
63
64 Note that your Google Voice login information is probably the same as your
65 gmail login information. Please be careful with your login credentials!
66 (It is not a bad idea to setup an entirely separate Google Voice account
67 just for sending SMS.)
68 """
69 global _voice
70
71 _voice = googlevoice.Voice()
72 _voice.login(email, passwd)
73
74
76 """
77 Sends an SMS message to phone_number (which should be a string) with
78 a message containing msg.
79
80 _gv_login MUST be called before _gv_send can be called. _gv_login only
81 needs to be called once per program execution.
82
83 Note that these are SMS messages, and each SMS message is limited to
84 160 characters. If msg is longer than that, it will be broken up into
85 multiple SMS messages.
86 """
87 _voice.send_sms(phone_number, msg)
88