Basic config and test
This commit is contained in:
parent
b34ab5d2fa
commit
dfec33a446
3 changed files with 40 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
config.ini
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
|
|
7
config.example.ini
Normal file
7
config.example.ini
Normal file
|
@ -0,0 +1,7 @@
|
|||
[main]
|
||||
host = https://cal.edgarpierre.fr
|
||||
username = edpibu
|
||||
password = ********
|
||||
|
||||
[logging]
|
||||
level = INFO
|
31
src/__main__.py
Normal file
31
src/__main__.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
import argparse
|
||||
import configparser
|
||||
import logging
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
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()
|
||||
|
||||
log.info(pri)
|
Reference in a new issue