This repository has been archived on 2022-01-29. You can view files and clone it, but cannot push or open issues or pull requests.
saturn/src/__main__.py

42 lines
1 KiB
Python
Raw Normal View History

2022-01-25 18:43:10 +01:00
import argparse
import configparser
import logging
2022-01-26 15:35:02 +01:00
## dev imports
from pprint import pp
import sys
2022-01-25 18:43:10 +01:00
from pathlib import Path
2022-01-26 15:35:02 +01:00
from datetime import date
2022-01-25 18:43:10 +01:00
import caldav
parser = argparse.ArgumentParser(description='Web-based CalDav client')
parser.add_argument('-c', '--config', type=Path, default='config.ini',
help='Configuration file path')
args = parser.parse_args()
config = configparser.ConfigParser()
config.read(args.config)
logging.basicConfig(level=config.get('logging', 'level', fallback='WARN'))
log = logging.getLogger('saturn')
log.info('Starting saturn')
cli = caldav.davclient.DAVClient(
config.get('caldav', 'host'),
username=config.get('caldav', 'username', fallback=None),
password=config.get('caldav', 'password', fallback=None),
)
pri = cli.principal()
2022-01-26 15:35:02 +01:00
for cal in pri.calendars():
for event in cal.date_search(start=date.today()):
pp(event)
event.load()
pp(event.instance)
pp(event.instance.vevent.dtstart.value)
sys.exit(0)