The python-googlevoice project aims to bring the power of the Google Voice API to the Python language in a simple, easy-to-use manner. Currently it allows you to place calls, send sms, download voicemails/recorded messages, and search the various folders of your Google Voice Accounts. You can use the Python API or command line script to schedule calls, check for new received calls/sms, or even sync your recorded voicemails/calls. Works for Python 2 and Python 3
Special thanks goes out to Chad Smith for posting his knowledge of the API (http://posttopic.com/topic/google-voice-add-on-development). Some of the python code was adapted from his Firefox addon.
Download the code from Google Code and install the module
$ hg clone https://pygooglevoice.googlecode.com/hg/ pygooglevoice
$ cd pygooglevoice
$ sudo python setup.py install
Here's an example of how to make an outgoing call. The first phone number is the outgoing number (the one you are trying to reach), and the second is the phone you want Google Voice to ring.
>>> from googlevoice import Voice
>>> voice = Voice()
>>> voice.call('18004664411', '14075551234')
The project comes with a script called gvoice which can do all the features of the module interactively. Try following this example to get the same effect as the code above
$ gvoice -e firstname.lastname@example.org
Outgoing number: 18004664411
Forwarding number: 14075551234