-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·36 lines (28 loc) · 934 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
"""Some documentation would be nice!"""
from __future__ import with_statement
__author__ = ""
__version__ = "$Id$"
import auth
import os
import re
import snag_events
def _PrintOwnCalendars(calendar_service):
feed = calendar_service.GetOwnCalendarsFeed()
print feed.title.text
for i, a_calendar in enumerate(feed.entry):
print '\t%s. %s' % (i, a_calendar.title.text,)
def _snag_local_auth_info():
data = {}
with open(os.path.join(os.getenv("HOME"), ".gmail-test-account-auth-info")) as fh:
for line in fh:
m = re.match("(.*?): (.*)", line)
if m:
data[m.group(1)] = m.group(2)
print data
return data
if __name__ == "__main__":
auth_data = _snag_local_auth_info()
cs = auth.auth(auth_data['username'], auth_data['password'])
print "I guess it worked:", cs
print len(list(snag_events.EventIterator(cs))), "events"