Code Documentation

GoogleAlerts Interface

class google_alerts.GoogleAlerts(email=None, password=None)[source]
_config_bootstrap()[source]

Go through and establish the defaults on the file system.

The approach here was stolen from the CLI tool provided with the module. Idea being that the user should not always need to provide a username and password in order to run the script. If the configuration file is already present with valid data, then lets use it.

_logger()[source]

Create a logger to be used between processes.

Returns:Logging instance.
_process_state()[source]

Process the application state configuration.

Google Alerts manages the account information and alert data through some custom state configuration. Not all values have been completely enumerated.

_session_check()[source]

Attempt to authenticate the user through a session file.

This process is done to avoid having to authenticate the user every single time. It uses a session file that is saved when a valid session is captured and then reused. Because sessions can expire, we need to test the session prior to calling the user authenticated. Right now that is done with a test string found in an unauthenticated session. This approach is not an ideal method, but it works.

authenticate()[source]

Authenticate the user and setup our state.

create(term, options)[source]

Create a monitor using passed configuration.

delete(monitor_id)[source]

Delete a monitor by ID.

delete_by_term(term)[source]

Delete an alert by term.

list(term=None)[source]

List alerts configured for the account.

At the time of processing, here are several state examples:

  • [‘062bc676ab9e9d9b:5a96b75728adb9d4:com:en:US’, [None, None, [‘email_aih_all’, ‘com’, [‘en’, ‘US’], None, None, None, False], None, 2, [[1, ‘XXX@gmail.com’, [], 1, ‘en-US’, 1, None, None, None, None, ‘7290377213681086747’, None, None, ‘AB2Xq4g1vxP5nJCT4SVMp8-8CeYubB7G0yQdZnM’]]], ‘06449491676132715360’]
  • [‘062bc676ab9e9d9b:eb34fff1681232ae:com:en:US’, [None, None, [‘email_aih_best’, ‘com’, [‘en’, ‘US’], None, None, None, False], None, 3, [[1, ‘XXX@gmail.com’, [], 1, ‘en-US’, 1, None, None, None, None, ‘11048899972761343896’, None, None, ‘AB2Xq4ibeyRSs4e6CQEjGTYWRyQgHftJgjkGmdE’]]], ‘06449491676132715360’]
  • [‘062bc676ab9e9d9b:029a12ab092e4d48:com:en:US’, [None, None, [‘email_d_all’, ‘com’, [‘en’, ‘US’], None, None, None, False], None, 2, [[1, ‘XXX@gmail.com’, [None, 18], 2, ‘en-US’, 1, None, None, None, None, ‘13677540305540568185’, None, None, ‘AB2Xq4iqyPDNCX_G_ZahmtXr3Ev1Xxk71J3A9o8’]]], ‘06449491676132715360’]
  • [‘062bc676ab9e9d9b:be633f8e2d769ed1:com:en:US’, [None, None, [‘email_d_best’, ‘com’, [‘en’, ‘US’], None, None, None, False], None, 3, [[1, ‘XXX@gmail.com’, [None, 18], 2, ‘en-US’, 1, None, None, None, None, ‘3165773263851675895’, None, None, ‘AB2Xq4gAyl3SR-5AKh3NstCHFf3I5tOCH_8Te98’]]], ‘06449491676132715360’]
  • [‘062bc676ab9e9d9b:4064fca73997bea1:com:en:US’, [None, None, [‘email_w_all’, ‘com’, [‘en’, ‘US’], None, None, None, False], None, 2, [[1, ‘XXX@gmail.com’, [None, 18, 0], 3, ‘en-US’, 1, None, None, None, None, ‘1277526588871069988’, None, None, ‘AB2Xq4jNqRCDJaqIvPfZTI6Sos2MMPb5q_6jS14’]]], ‘06449491676132715360’]
  • [‘062bc676ab9e9d9b:ed3adf6fd0968cb0:com:en:US’, [None, None, [‘email_w_best’, ‘com’, [‘en’, ‘US’], None, None, None, False], None, 3, [[1, ‘XXX@gmail.com’, [None, 18, 0], 3, ‘en-US’, 1, None, None, None, None, ‘11943490843312281977’, None, None, ‘AB2Xq4gvnjg6s07wCxTs4Ag8_6uOC0u9-7Aiu8E’]]], ‘06449491676132715360’]
  • [‘062bc676ab9e9d9b:a92eace4d0488209:com:en:US’, [None, None, [‘rss_aih_best’, ‘com’, [‘en’, ‘US’], None, None, None, False], None, 3, [[2, ‘’, [], 1, ‘en-US’, 1, None, None, None, None, ‘10457927733922767031’, None, None, ‘AB2Xq4jZ1IPZLS44ZpaXYn8Fh46euu8_so_2k7k’]]], ‘06449491676132715360’]
  • [‘062bc676ab9e9d9b:ac4752c338e8c363:com:en:US’, [None, None, [‘rss_all’, ‘com’, [‘en’, ‘US’], None, None, None, False], None, 2, [[2, ‘’, [], 1, ‘en-US’, 1, None, None, None, None, ‘17387577876633356534’, None, None, ‘AB2Xq4h1wQcVxLfb0s835KmJWdw7bfUzzwpjUrg’]]], ‘06449491676132715360’]
modify(monitor_id, options)[source]

Create a monitor using passed configuration.

set_log_level(level)[source]

Override the default log level of the class