Welcome to googlevoice documentation!

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.

class googlevoice.Voice

Bases: object

Main voice instance for interacting with the Google Voice service Handles login/logout and most of the baser HTTP methods

archive(msg, archive=1)

Archive the specified message by removing it from the Inbox.

call(outgoingNumber, forwardingNumber=None, phoneType=None, subscriberNumber=None)

Make a call to an outgoingNumber from your forwardingNumber (optional). If you pass in your forwardingNumber, please also pass in the correct phoneType

cancel(outgoingNumber=None, forwardingNumber=None)

Cancels a call matching outgoing and forwarding numbers (if given). Will raise an error if no matching call is being placed

property contacts

Partial data of your Google Account Contacts related to your Voice account. For a more comprehensive suite of APIs, check out http://code.google.com/apis/contacts/docs/1.0/developers_guide_python.html

delete(msg, trash=1)

Moves this message to the Trash. Use message.delete(0) to move it out of the Trash.

download(msg, adir=None)

Download a voicemail or recorded call MP3 matching the given msg which can either be a Message instance, or a SHA1 identifier. Saves files to adir (defaults to current directory). Message hashes can be found in self.voicemail().messages for example. Returns location of saved file.

login(email=None, passwd=None, smsKey=None)

Login to the service using your Google Voice account Credentials will be propmpted for if not given as args or in the ~/.gvoice config file

logout()

Logs out an instance and makes sure it does not still have a session

property phones

Returns a list of Phone instances attached to your account.

search(query)

Search your Google Voice Account history for calls, voicemails, and sms Returns Folder instance containting matching messages

send_sms(phoneNumber, text)

Send an SMS message to a given phoneNumber with the given text message

property settings

Dict of current Google Voice settings

property special

Returns special identifier for your session (if logged in)

user_agent = 'googlevoice/3.0.0 Python/3.7.3'
class googlevoice.Phone(voice, data)

Bases: googlevoice.util.AttrDict

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)

disable()

Disables this phone

enable()

Enables this phone for usage

class googlevoice.Message(folder, id, data)

Bases: googlevoice.util.AttrDict

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

delete(trash=1)

Moves this message to the Trash. Use message.delete(0) to move it out of the Trash.

download(adir=None)

Download the message MP3 (if any). Saves files to adir (defaults to current directory). Message hashes can be found in self.voicemail().messages for example. Returns location of saved file.

mark(read=1)

Mark this message as read. Use message.mark(0) to mark it as unread.

star(star=1)

Star this message. Use message.star(0) to unstar it.

class googlevoice.Folder(voice, name, data)

Bases: googlevoice.util.AttrDict

Folder wrapper for feeds from Google Voice Attributes are:

  • totalSize: int (aka __len__)

  • unreadCounts: dict

  • resultsPerPage: int

  • messages: list of Message instances

property messages

Returns a list of all messages in this folder

Indices and tables