Mercurial > code > home > repos > gcalendarwatch
changeset 37:2da773e48a57
credential code update. needed to rm pickle and relogin
author | drewp@bigasterisk.com |
---|---|
date | Sun, 12 Nov 2023 23:20:37 -0800 |
parents | cb990883e52f |
children | d686e4a5b892 |
files | calendar_connection.py gcalendarwatch.py login.py run_login.sh |
diffstat | 4 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/calendar_connection.py Sun Nov 12 23:19:23 2023 -0800 +++ b/calendar_connection.py Sun Nov 12 23:20:37 2023 -0800 @@ -6,7 +6,7 @@ from googleapiclient.discovery import build, Resource -def getCalendarService(scope='https://www.googleapis.com/auth/calendar.events') -> Resource: +def getCalendarService() -> Resource: """ """ creds = None @@ -21,7 +21,10 @@ if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: - flow = InstalledAppFlow.from_client_secrets_file('credentials/cred.json', [scope]) + flow = InstalledAppFlow.from_client_secrets_file('credentials/cred.json', [ + 'https://www.googleapis.com/auth/calendar.events', + "https://www.googleapis.com/auth/calendar.readonly", + ]) creds = flow.run_local_server() # Save the credentials for the next run with open('credentials/token.pickle', 'wb') as token:
--- a/gcalendarwatch.py Sun Nov 12 23:19:23 2023 -0800 +++ b/gcalendarwatch.py Sun Nov 12 23:20:37 2023 -0800 @@ -38,7 +38,7 @@ from ingest import SyncToMongo from localtypes import Conf, Record -logging.basicConfig(level=logging.INFO) +logging.basicConfig(level=logging.DEBUG) log = logging.getLogger() EV = Namespace("http://bigasterisk.com/event#") @@ -233,7 +233,7 @@ Route('/pollNow', functools.partial(PollNow, loop), methods=['POST']) ]) - app.add_middleware(PrometheusMiddleware, app_name='gcalendarwatch') + app.add_middleware(PrometheusMiddleware, group_paths=True, filter_unhandled_paths=True, app_name='gcalendarwatch') app.add_route("/metrics", handle_metrics) return app
--- a/login.py Sun Nov 12 23:19:23 2023 -0800 +++ b/login.py Sun Nov 12 23:20:37 2023 -0800 @@ -1,4 +1,4 @@ -"""run this to update auth files, the rebuild docker""" +"""run this to update auth files, then rebuild docker""" import logging
--- a/run_login.sh Sun Nov 12 23:19:23 2023 -0800 +++ b/run_login.sh Sun Nov 12 23:20:37 2023 -0800 @@ -7,9 +7,6 @@ # if you need a new cred.json, # https://console.cloud.google.com/apis/credentials/oauthclient/382685977333-u6eii6n60a8soptaagan3ruv4akq5uuf.apps.googleusercontent.com?project=bigasterisk-910 -echo run this on dash -setup_home_venv -~/.venvs/gcalendarwatch/bin/python3 login.py +pdm run python login.py +echo wrote credentials/token.pickle -echo wrote token.pickle -