moved caldav credentials to untracked config.ini

This commit is contained in:
eclipse 2025-03-08 12:19:40 +01:00
parent 8a75391679
commit eba34e08ac

View File

@ -1,18 +1,24 @@
import configparser
import caldav import caldav
import vobject import vobject
from datetime import datetime, date, time, timedelta from datetime import datetime, date, time, timedelta
import yaml import yaml
import os import os
"""CalDAV server url"""
server_url = "https://***REMOVED*** # read ini file
"""CalDAV calendar url""" cp = configparser.ConfigParser()
cal_url = "https://***REMOVED*** cp.read('../config.ini')
"""CalDAV username""" server_url = cp["CalDAV"]["server_url"]
cal_user = "tobias" cal_url = cp["CalDAV"]["cal_url"]
cal_user = cp["CalDAV"]["cal_user"]
cal_pass = cp["CalDAV"]["cal_pass"]
print
"""Category to filter events for. Only events that belong to this category will be processed.""" """Category to filter events for. Only events that belong to this category will be processed."""
cal_category = "Veranstaltung" cal_category = "Veranstaltung"
"""Name of the file the YAML data will be writte to.""" """Name of the file the YAML data will be written to."""
result_file = "../content/pages/termine.md" result_file = "../content/pages/termine.md"
"""List of icalendar properties that will be passed on to Pelican. At this time, all properties are used except those regarding alarms.""" """List of icalendar properties that will be passed on to Pelican. At this time, all properties are used except those regarding alarms."""
cal_properties = [ # taken from ical specification cal_properties = [ # taken from ical specification
@ -85,10 +91,6 @@ def extractEventData(events):
e_tmp.append(d) e_tmp.append(d)
return e_tmp return e_tmp
# get password
with open(".caldav_pass", "r") as f:
cal_pass = f.read().strip()
# create vobject calendar # create vobject calendar
vcal = vobject.newFromBehavior("vcalendar") vcal = vobject.newFromBehavior("vcalendar")