some cleaning
This commit is contained in:
parent
f1ff6afdc8
commit
acc66afebb
1 changed files with 3 additions and 6 deletions
9
main.py
9
main.py
|
|
@ -5,7 +5,7 @@ from caldav import DAVClient, Calendar, Principal, Todo
|
||||||
import configparser
|
import configparser
|
||||||
|
|
||||||
|
|
||||||
def parseConfig():
|
def parseConfig() -> tuple[str, str, str, str]:
|
||||||
def passwordFromFile() -> str:
|
def passwordFromFile() -> str:
|
||||||
calDavPasswordFile = config.get("calDAV", "passwordFile")
|
calDavPasswordFile = config.get("calDAV", "passwordFile")
|
||||||
with open(calDavPasswordFile, "r") as file:
|
with open(calDavPasswordFile, "r") as file:
|
||||||
|
|
@ -13,8 +13,8 @@ def parseConfig():
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read("/etc/calDAVtoCSV/config.ini")
|
config.read("/etc/calDAVtoCSV/config.ini")
|
||||||
|
|
||||||
calDavAddress = config.get("calDAV", "address")
|
calDavAddress = config.get("calDAV", "address")
|
||||||
print(calDavAddress)
|
|
||||||
calDavUsername = config.get("calDAV", "username")
|
calDavUsername = config.get("calDAV", "username")
|
||||||
caldavpwd = config.get("calDAV", "password", fallback=None)
|
caldavpwd = config.get("calDAV", "password", fallback=None)
|
||||||
caldavpwd = caldavpwd if caldavpwd is not None else passwordFromFile()
|
caldavpwd = caldavpwd if caldavpwd is not None else passwordFromFile()
|
||||||
|
|
@ -50,10 +50,6 @@ def fetch_10_next_todos_as_csv() -> str:
|
||||||
return csv
|
return csv
|
||||||
|
|
||||||
|
|
||||||
def put(todos, uid):
|
|
||||||
item = filter(lambda todo: todo.icalendar_component["uid"] == uid, todos)
|
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -62,5 +58,6 @@ def send_events():
|
||||||
return fetch_10_next_todos_as_csv()
|
return fetch_10_next_todos_as_csv()
|
||||||
|
|
||||||
|
|
||||||
|
# not suitable for production apparently, just for testing
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host="0.0.0.0", port=8000)
|
app.run(host="0.0.0.0", port=8000)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue