summaryrefslogtreecommitdiff
path: root/exchange/wsgi.py
blob: bf2baf0844cfd5c91b7fb2ed65668265b62a74e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# vim: set filencoding=utf8
"""
Calendar WSGI App

@author: Mike Crute (mcrute@ag.com)
@organization: American Greetings Interactive
@date: February 15, 2010
"""

from exchange.commands import FetchCalendar
from exchange.authenticators import CookieSession


class CalendarApp(object):

    def __init__(self, exchange_server, user, password):
        self.session = CookieSession(exchange_server,
                                        username=user, password=password)

    def __call__(self, environ, start_response):
        start_response('200 OK', [])
        command = FetchCalendar(self.session)
        calendar = command.execute()
        return calendar.as_string()