Mercurial > code > home > repos > gcalendarwatch
annotate gcalendarwatch.py @ 91:62caecb41dfd default tip
fix tag
author | drewp@bigasterisk.com |
---|---|
date | Fri, 03 Jan 2025 18:06:13 -0800 |
parents | f75b3a109b66 |
children |
rev | line source |
---|---|
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
1 """ |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
2 read calendar from mongodb, return a few preset queries as RDF graphs |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
3 |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
4 gcalendarwatch.conf looks like this: |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
5 { |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
6 "mongo" : {"host" : "h1", "port" : 27017, "database" : "dbname"}, |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
7 } |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
8 """ |
16
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
9 import datetime |
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
10 import json |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
11 import logging |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
12 import re |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
13 from typing import Sequence, cast |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
14 |
29 | 15 import background_loop |
42
7d9609edcf9c
track calendar feed summary/description text and emit them in graphs
drewp@bigasterisk.com
parents:
39
diff
changeset
|
16 import pymongo.collection |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
17 import pymongo.database |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
18 from dateutil.tz import tzlocal |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
19 from patchablegraph import PatchableGraph |
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
20 from patchablegraph.handler import GraphEvents, StaticGraph |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
21 from pymongo import MongoClient |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
22 from rdflib import Namespace |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
23 from starlette.applications import Starlette |
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
24 from starlette.requests import Request |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
25 from starlette.responses import HTMLResponse |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
26 from starlette.routing import Route |
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
27 from starlette_exporter import PrometheusMiddleware, handle_metrics |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
28 |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
29 from datetimemath import dayRange, limitDays |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
30 from graphconvert import asGraph |
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
31 from localtypes import Conf, Record |
16
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
32 |
39 | 33 logging.basicConfig(level=logging.INFO) |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
34 log = logging.getLogger() |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
35 |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
36 EV = Namespace("http://bigasterisk.com/event#") |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
37 """ |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
38 example: |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
39 { |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
40 'id': 'l640999999999999999999999c', |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
41 'summary': 'sec.......', |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
42 'start': {'timeZone': 'America/Los_Angeles', 'dateTime': '2014-09-25T16:00:00-07:00'}, |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
43 'end': {'timeZone': 'America/Los_Angeles', 'dateTime': '2014-09-25T17:00:00-07:00'}, |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
44 'endTimeUnspecified': True, |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
45 'created': '2014-09-08T20:39:00.000Z', |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
46 'creator': {'self': True, 'displayName': '...', 'email': '...'}, |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
47 'etag': '"2829999999999000"', |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
48 'htmlLink': 'https://www.google.com/calendar/event?eid=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbEBt', |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
49 'iCalUID': 'l640998888888888888888888888888888com', |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
50 'kind': 'calendar#event', |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
51 'organizer': {'self': True, 'displayName': '...', 'email': '...'}, |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
52 'reminders': {'useDefault': True}, |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
53 'sequence': 0, |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
54 'status': 'confirmed', |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
55 'updated': '2014-09-17T04:28:56.997Z', |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
56 }""" |
16
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
57 |
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
58 |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
59 def filterStarred(recs: Sequence[Record], maxCount=15) -> list[Record]: |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
60 recs = sorted(recs, key=lambda r: r['start']) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
61 out = [] |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
62 for rec in recs: |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
63 if m := re.search(r'(.*)\*\s*$', rec['title']): |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
64 rec = rec.copy() |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
65 rec['title'] = m.group(1) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
66 out.append(rec) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
67 if len(out) >= maxCount: |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
68 break |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
69 return out |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
70 |
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
71 |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
72 class SyncGraphsToMongo(object): |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
73 """reads mongodb (that calsync wrote); edits graphs""" |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
74 calendarsCollection: pymongo.collection.Collection |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
75 eventsCollection: pymongo.collection.Collection |
16
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
76 |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
77 def __init__(self, conf: Conf, db: pymongo.database.Database, agendaGraph: PatchableGraph, countdownGraph: PatchableGraph, |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
78 currentEventsGraph: PatchableGraph): |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
79 self.conf = conf |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
80 self.eventsCollection = db.get_collection('test_gcalendar') |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
81 self.calendarsCollection = db.get_collection('test_gcalendar_cals') |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
82 |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
83 self.agendaGraph = agendaGraph |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
84 self.countdownGraph = countdownGraph |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
85 self.currentEventsGraph = currentEventsGraph |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
86 |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
87 def _getEvents(self, t1: datetime.datetime, t2: datetime.datetime) -> list[Record]: |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
88 if t1.tzinfo is None or t2.tzinfo is None: |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
89 raise TypeError("tz-naive datetimes") |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
90 return list(self.eventsCollection.find({"startTime": {"$gte": t1, "$lt": t2}}).sort([("startTime", 1)])) |
1 | 91 |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
92 def updateGraphs(self, first_run): |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
93 s, e = dayRange(120) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
94 currentRecords = self._getEvents(s, e) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
95 cals = list(self.calendarsCollection.find()) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
96 self.agendaGraph.setToGraph(asGraph(self.conf, cals, limitDays(currentRecords, days=2))) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
97 self.countdownGraph.setToGraph(asGraph(self.conf, cals, filterStarred(currentRecords, maxCount=15), extraClasses=[EV['CountdownEvent']])) |
16
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
98 |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
99 now = datetime.datetime.now(tzlocal()) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
100 events = list(self.eventsCollection.find({"startTime": {"$lte": now}, "endTime": {"$gte": now}})) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
101 self.currentEventsGraph.setToGraph(asGraph(self.conf, cals=[], events=events, extraClasses=[EV['CurrentEvent']])) |
43
b5d3d9a8c83d
new graph of just the events happening now
drewp@bigasterisk.com
parents:
42
diff
changeset
|
102 |
b5d3d9a8c83d
new graph of just the events happening now
drewp@bigasterisk.com
parents:
42
diff
changeset
|
103 |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
104 def main(): |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
105 agendaGraph = PatchableGraph(label='agenda') # next few days |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
106 countdownGraph = PatchableGraph(label='countdown') # next n of starred events |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
107 currentEventsGraph = PatchableGraph(label='currentEvents') # events happening now |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
108 |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
109 conf = cast(Conf, json.load(open("gcalendarwatch.conf"))) |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
110 m = conf['mongo'] |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
111 db = MongoClient(m['host'], m['port'], tz_aware=True)[m['database']] |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
112 sync = SyncGraphsToMongo(conf, db, agendaGraph, countdownGraph, currentEventsGraph) |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
113 |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
114 # todo: this should watch for mongodb edits, or get a signal from calsync |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
115 background_loop.loop_forever(sync.updateGraphs, 5, metric_prefix="update_graphs") |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
116 |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
117 def getRoot(request: Request) -> HTMLResponse: |
85
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
118 return HTMLResponse(content=open("index.html").read()) |
f75b3a109b66
rewrite gcalendarwatch to read from calsync's mongo data only, not google services
drewp@bigasterisk.com
parents:
84
diff
changeset
|
119 |
84
5f7ae444ecae
more custom namespaces in debug graph displays
drewp@bigasterisk.com
parents:
45
diff
changeset
|
120 moreNs = { |
5f7ae444ecae
more custom namespaces in debug graph displays
drewp@bigasterisk.com
parents:
45
diff
changeset
|
121 "": "http://bigasterisk.com/event#", |
5f7ae444ecae
more custom namespaces in debug graph displays
drewp@bigasterisk.com
parents:
45
diff
changeset
|
122 "cal": "http://bigasterisk.com/calendar/", |
5f7ae444ecae
more custom namespaces in debug graph displays
drewp@bigasterisk.com
parents:
45
diff
changeset
|
123 "event": "http://bigasterisk.com/calendarEvent/", |
5f7ae444ecae
more custom namespaces in debug graph displays
drewp@bigasterisk.com
parents:
45
diff
changeset
|
124 } |
16
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
125 |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
126 app = Starlette(debug=True, |
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
127 routes=[ |
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
128 Route('/', getRoot), |
84
5f7ae444ecae
more custom namespaces in debug graph displays
drewp@bigasterisk.com
parents:
45
diff
changeset
|
129 Route('/graph/calendar/upcoming', StaticGraph(agendaGraph, moreNs)), |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
130 Route('/graph/calendar/upcoming/events', GraphEvents(agendaGraph)), |
84
5f7ae444ecae
more custom namespaces in debug graph displays
drewp@bigasterisk.com
parents:
45
diff
changeset
|
131 Route('/graph/calendar/countdown', StaticGraph(countdownGraph, moreNs)), |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
132 Route('/graph/calendar/countdown/events', GraphEvents(countdownGraph)), |
84
5f7ae444ecae
more custom namespaces in debug graph displays
drewp@bigasterisk.com
parents:
45
diff
changeset
|
133 Route('/graph/currentEvents', StaticGraph(currentEventsGraph, moreNs)), |
43
b5d3d9a8c83d
new graph of just the events happening now
drewp@bigasterisk.com
parents:
42
diff
changeset
|
134 Route('/graph/currentEvents/events', GraphEvents(currentEventsGraph)), |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
135 ]) |
16
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
136 |
37
2da773e48a57
credential code update. needed to rm pickle and relogin
drewp@bigasterisk.com
parents:
29
diff
changeset
|
137 app.add_middleware(PrometheusMiddleware, group_paths=True, filter_unhandled_paths=True, app_name='gcalendarwatch') |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
138 app.add_route("/metrics", handle_metrics) |
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
139 return app |
0
e40034f22c69
moved from pimscreen, upgrade to py3. Redo google auth.
drewp@bigasterisk.com
parents:
diff
changeset
|
140 |
16
a87969972d85
lib updates, auth update and cleanup, reformat
drewp@bigasterisk.com
parents:
15
diff
changeset
|
141 |
28
e2209226b001
rewrite with starlette and background_loop
drewp@bigasterisk.com
parents:
23
diff
changeset
|
142 app = main() |