This 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
In addition to the methods below, Voice instances have several special methods for gathering information from folders in the Google Voice service. These methods are:
- inbox - Recent, unread messages
- starred - Starred messages
- all - All messages
- spam - Messages likely to be spam
- trash - Deleted messages
- voicemail - Voicemail messages
- sms - Text messages
- recorded - Recorced messages
- placed - Outgoing messages
- received - Incoming messages
- missed - Messages not received
All of these special methods operate the same way. When they are called, they parse the feed from the Google Voice service and return a Folder instance. After they have been called, you can grab the JSON and HTML data directly.
Usage:
>>> voice.inbox() # Parses feed and returns Folder instance
... <Folder inbox (9)>
>>> voice.inbox.json # Raw JSON data
... u'{"messages":{"14ef89...'
>>> voice.inbox.html # Raw HTML data
... u'\n\n \n<div id="14fe89...'
>>> voice.inbox.folder # Just returns Folder instance
... <Folder inbox (9)>
Main voice instance for interacting with the Google Voice service Handles login/logout and most of the baser HTTP methods
Wrapper for phone objects used for phone specific methods Attributes are:
- id: int
- phoneNumber: i18n phone number
- formattedNumber: humanized phone number string
- we: data dict
- wd: data dict
- verified: bool
- name: strign label
- smsEnabled: bool
- scheduleSet: bool
- policyBitmask: int
- weekdayTimes: list
- dEPRECATEDDisabled: bool
- weekdayAllDay: bool
- telephonyVerified
- weekendTimes: list
- active: bool
- weekendAllDay: bool
- enabledForOthers: bool
- type: int (1 - Home, 2 - Mobile, 3 - Work, 4 - Gizmo)
Wrapper for all call/sms message instances stored in Google Voice Attributes are:
- id: SHA1 identifier
- isTrash: bool
- displayStartDateTime: datetime
- star: bool
- isSpam: bool
- startTime: gmtime
- labels: list
- displayStartTime: time
- children: str
- note: str
- isRead: bool
- displayNumber: str
- relativeStartTime: str
- phoneNumber: str
- type: int
XML Parser helper that can dig json and html out of the feeds. The parser takes a Voice instance, page name, and function to grab data from. Calling the parser calls the data function once, sets up the json and html attributes and returns a Folder instance for the given page:
>>> o = XMLParser(voice, 'voicemail', lambda: 'some xml payload')
>>> o()
... <Folder ...>
>>> o.json
... 'some json payload'
>>> o.data
... 'loaded json payload'
>>> o.html
... 'some html payload'