changeset 1:d77ead665ab2

whitespace Ignore-this: ebd8537fba270e8b025d2ef5ffc0f0f7
author drewp@bigasterisk.com
date Thu, 16 Jan 2020 23:33:33 -0800
parents e40034f22c69
children 30f9d65ceba1
files gcalendarwatch
diffstat 1 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/gcalendarwatch	Tue Jun 25 17:08:27 2019 -0700
+++ b/gcalendarwatch	Thu Jan 16 23:33:33 2020 -0800
@@ -18,8 +18,8 @@
 
 from dateutil.parser import parse
 from dateutil.tz import tzlocal
-from googleapiclient import discovery 
-from googleapiclient.http import build_http 
+from googleapiclient import discovery
+from googleapiclient.http import build_http
 from pymongo import MongoClient
 from rdflib import Namespace, Literal, Graph, URIRef, RDF
 from twisted.internet import reactor
@@ -100,7 +100,7 @@
 
 def asN3(events, conf):
     return asGraph(events, conf).serialize(format='n3')
-    
+
 def asGraph(events, conf):
     graph = Graph()
     graph.namespace_manager.bind('ev', EV)
@@ -132,18 +132,18 @@
     'other'.
     """
     flow = oauth2client.client.flow_from_clientsecrets(client_secrets, scope=scope)
-   
-    storage = oauth2client.file.Storage(credential_storage) 
-    credentials = storage.get() 
+
+    storage = oauth2client.file.Storage(credential_storage)
+    credentials = storage.get()
     if credentials is None or credentials.invalid:
         class Flags:
             logging_level = 'INFO'
             noauth_local_webserver = True
         credentials = oauth2client.tools.run_flow(flow, storage, Flags)
         # (storage now writes back to calendar.dat)
-    http = credentials.authorize(http=build_http()) 
-   
-    service = discovery.build(name, version, http=http) 
+    http = credentials.authorize(http=build_http())
+
+    service = discovery.build(name, version, http=http)
     return service
 
 def getFirstPageOfCalendars(service):
@@ -155,7 +155,7 @@
     start = now
     end = now + datetime.timedelta(days=days)
     return start, end
-        
+
 def limitDays(recs, days):
     start, end = dayRange(days)
     start = start - datetime.timedelta(hours=12)
@@ -179,7 +179,7 @@
             if len(out) >= maxCount:
                 break
     return out
-        
+
 class SyncToMongo(object):
     """reads gcal, writes to mongodb"""
     def __init__(self, conf, collection, agendaGraph, countdownGraph):
@@ -204,14 +204,14 @@
                 showDeleted=False,
                 maxResults=1000,
             ).execute()
-            
+
             for ev in events['items']:
                 rec = recordFromEv(self.conf, calId, ev)
                 self.upsertMongo(rec)
                 currentRecords.append(rec)
 
         self.updateGraphs(currentRecords)
-        
+
     def removeEntries(self, start, end):
         for doc in list(self.collection.find({"startTime":{"$gte":start, "$lte":end}})):
             self.collection.remove({'_id':doc['_id']})
@@ -235,7 +235,7 @@
             [(s,p,o,c) for s,p,o in asGraph(limitDays(currentRecords, days=2), self.conf)])
         self.countdownGraph.setToGraph(
             [(s,p,o,c) for s,p,o in asGraph(filterStarred(currentRecords, maxCount=15), self.conf)])
-        
+
 
 class ReadMongoEvents(object):
     """read events from mongodb"""
@@ -314,8 +314,8 @@
         else:
             self.set_header("content-type", "text/n3")
             self.write(asN3(self.settings.read.getEvents(t1, t2), self.settings.conf))
-    
-            
+
+
 class Countdowns(cyclone.web.RequestHandler):
     def get(self):
         rows = []
@@ -339,7 +339,7 @@
             "@graph": rows,
             }))
 
-            
+
 def main():
     args = docopt.docopt('''
 Usage:
@@ -363,7 +363,7 @@
     sync.updateGraphs(read.getEvents(
         datetime.datetime.now().replace(hour=0, minute=0, second=0),
         datetime.datetime.now() + datetime.timedelta(days=60)))
-    
+
     poller = Poller(sync, conf['minutes_between_polls'] * 60)
 
     class Application(cyclone.web.Application):