Hardware Reference
In-Depth Information
Setting up the parser for reminders
and events
In this task, we will implement a module that will blink an LED to remind us about important
events and appointments.
Prepare for lift off
The Google Data Python client library is required for this task. You also have to save some
tasks in your calendar to test the implementaion.
Engage thrusters
1. Using the Python IDLE's editor, let's get started by creaing a new ile called
calendars.py :
import gdata.calendar.service
import gdata.service
import gdata.calendar
import time
2. We can get started by defining a Google Calendar object. We will define the
username and password for our Google account:
calendar_service = gdata.calendar.service.CalendarService()
calendar_service.email = 'username@gmail.com'
calendar_service.password = 'password'
calendar_service.ProgrammaticLogin()
3.
The calendar_query funcion performs a query for calendar events by deining a
ime frame as follows:
query = gdata.calendar.service.CalendarEventQuery('default','priva
te','full')
query.start_min = '2014-01-01'
query.start_max = '2013-05-31'
feed = calendar_service.CalendarQuery(query)
return feed
4. Let's create another Python script and test the funcionality of the calendar module
( calendar.py ). We will begin by imporing the previous deiniion as a module:
import calendar
feed = calendar.calendar_query()
 
Search WWH ::




Custom Search