summaryrefslogtreecommitdiff
path: root/server.py
blob: c3cd898de9ac163f772f6dab1ed4a7359bb63394 (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
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# vim: set filencoding=utf8
"""
Exchange Calendar Proxy Server

@author: Mike Crute (mcrute@gmail.com)
@organization: SoftGroup Interactive, Inc.
@date: April 26, 2009
"""

from os import path
from util import config_dict
from exchange.wsgi import CalendarApp
from wsgiref.simple_server import make_server


def main():
    config = config_dict(path.expanduser('~/.exchange.cfg'))
    password = open(path.expanduser('~/.exchange.pass'), 'r').read()

    try:
        app = CalendarApp(config['exchange']['server'],
                          config['exchange']['user'],
                          password)

        make_server(config['local_server']['address'],
                    config['local_server']['port'], app).serve_forever()
    except KeyboardInterrupt:
        print '\n All done, shutting down.'


if __name__ == '__main__':
    main()