From 99070355e0851fbac32322819b26a0d15451d36d Mon Sep 17 00:00:00 2001 From: Malte Londschien Date: Fri, 25 Aug 2023 14:07:10 +0200 Subject: [PATCH] Try googleapiclient. --- .github/workflows/weekly.yml | 2 +- crispybeefbot.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index 5e75d5e..e78532f 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -1,7 +1,7 @@ name: Daily runs on: schedule: - - cron: '0 8 * * 1' # 8am on mondays + - cron: '0 8 * * 1' # 8 am on mondays push: paths: - '.github/workflows/weekly.yml' diff --git a/crispybeefbot.py b/crispybeefbot.py index 6997848..16a4cd8 100644 --- a/crispybeefbot.py +++ b/crispybeefbot.py @@ -2,9 +2,9 @@ import json import os from email.message import EmailMessage - +import sys import requests -from google.oauth2.credentials import Credentials +from googleapiclient.oauth2.credentials import Credentials from googleapiclient.discovery import build url = "http://mensazurich.ch:8080/api/de/all/getMensaForCurrentWeek" @@ -21,6 +21,8 @@ if "crispy beef" in " ".join(menu["description"]).lower(): crispy_beefs += [(info["label"], date)] +if len(crispy_beefs) == 0: + sys.exit() subject = f"Crispy Beef on {' and '.join(c[0] for c in crispy_beefs)}"