]> projects.mako.cc - count_todo_items/commitdiff
several small improvements master
authorBenjamin Mako Hill <mako@atdot.cc>
Sat, 31 Aug 2019 18:22:26 +0000 (11:22 -0700)
committerBenjamin Mako Hill <mako@atdot.cc>
Sat, 31 Aug 2019 18:22:26 +0000 (11:22 -0700)
- altered to read password from a file
- deactivated the hard-coded password
- several other small rearrangements
- added password file to .gitignore

.gitignore
count_todo_items.py

index 0de367203603ce22f61b2e80f3cb7c3f27ad3d2d..42a07ddb59442984b942752d0788da6d54c89c92 100644 (file)
@@ -1 +1,2 @@
 mako_open_todos.csv
+nextcloud_password_file
index 2e13350c1e856098068abcab8710bcfc7967670c..d12f24971d2b63f2daddd7d6049b4c037d5694ec 100755 (executable)
@@ -1,5 +1,9 @@
 #!/usr/bin/env python3
 
+# configuration options
+database_filename = "mako_open_todos.csv"
+caldav_url = "https://mako:{pw}@nimbus.mako.cc/remote.php/dav/calendars/mako/personal/"
+
 import datetime
 import mailbox
 import numpy as np
@@ -9,8 +13,9 @@ import pandas as pd
 import caldav
 from caldav.elements import dav, cdav
 
-nimbus_password = '7TS3L-xABPz-8PJwn-zxAz7-ZY2Y5'
-database_filename = "mako_open_todos.csv"
+# read password from a file
+with open("nextcloud_password_file", "r") as f:
+    nimbus_password = f.read().strip()
 
 current_timestamp = datetime.datetime.now()
 data_original = pd.read_csv(database_filename)
@@ -42,7 +47,7 @@ data_email_uw = rows_from_mb_counts("UW inbox",
                                     get_flags_for_maildir("~/incoming/mail/uw-inbox"))
 
 # load calendar data
-caldav_client = caldav.DAVClient("https://mako:{pw}@nimbus.mako.cc/remote.php/dav/calendars/mako/personal/".format(pw=nimbus_password))
+caldav_client = caldav.DAVClient(caldav_url.format(pw=nimbus_password))
 cal = caldav_client.principal().calendars()[0]
 
 caldav_count = np.sum(["PERCENT-COMPLETE:100" not in c.data

Benjamin Mako Hill || Want to submit a patch?