Base hangouts management

Hangout API

Main module of Hangout that provide base HG management and call settings management.

class hangout_api.base.Hangouts(executable_path=None, chrome_options=None)[source]

Main class for controlling hangout calls.

Initialization does two things:
  1. Makes sure that there is active X session.
  2. Starts the browser.

If ‘DISPLAY’ can’t be found in os.environ than new X session starts. Starting new session handels PyVirtualDisplay.

For handling browser used seleniumwrapper library.

>>> hangout = Hangouts()
connect(hangout_id)[source]

Connect to an existing hangout. Takes id of targeted hangout as argument. Also it sets hangout_id property:

>>> hangout.connect('fnar4989hf9834h')
>>> hangout.hangout_id
'fnar4989hf9834h'
disconnect()[source]

Leave hangout (equal on clicking on “Leave call” button). After leaving the call you can create a new one or connect to existing.

>>> hangout.disconnect()
invite(participants)[source]

Invite person or circle to hangout:

>>> hangout.invite("persona@gmail.com")
>>> hangout.invite(["personb@gmail.com", "Public", "Friends"])
login(username, password, otp=None)[source]

Log in to google plus.

otp argument is one time password and it’s optional, set it only if you’re using 2-factor authorization.

>>> hangout.login('user@gmail.com', 'password')
>>> hangout.login('user_1@gmail.com', 'password', otp='123456')
participants()[source]

Returns list of namedtuples of current participants:

>>> hangout.participants()
[Participant(name='John Doe', profile_id='108775712935')]
start(on_air=None)[source]

Start a new hangout. After new hangout is created its id is stored in ‘hangout_id’ attribure

>>> hangout.start()
>>> hangout.hangout_id
'gs4pp6g62w65moctfqsvihzq2qa'

To start OnAir just pass on_air argument to ‘start’ method.

>>> hangout.start(
...   on_air={'name':'My OnAir', 'attendees':['Friends']})
>>> hangout.start(on_air='https://plus.google.com/events/df34...')