From c0da2b859f578f991682e64e507b8eeae8218e99 Mon Sep 17 00:00:00 2001 From: Larry Matter Date: Wed, 24 Jan 2024 14:20:48 -0800 Subject: [PATCH] Update README. Change to QOD_API_TOKEN for consistency. Added default to balena setup. --- README.md | 2 ++ balena.yml | 1 + inkyshot/update-display.py | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 17d0978..f657aca 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ Running this project is as simple as deploying it to a balenaCloud application. You can also deploy in the traditional manner using the balena CLI and `balena push` command. For more information [check out the docs](https://www.balena.io/docs/learn/deploy/deployment/). +UPDATE: The Quote of the Day service now requires authentication via API token. Please visit https://theysaidso.com/user/subscriptions to create an account and a token. You can set this token in the Balena deploy phase by selecting the advance setup option and updating the value of QOD_API_TOKEN. You can also set this later using the same process as other environment variables. + ## Customization Your fleet of Inkyshots can all be managed centrally via balenaCloud. Try any of the environment variables below to add some customization. diff --git a/balena.yml b/balena.yml index 072ad91..16231d1 100644 --- a/balena.yml +++ b/balena.yml @@ -22,6 +22,7 @@ data: applicationEnvironmentVariables: - UPDATE_HOUR: 9 - TZ: Europe/London + - QOD_API_TOKEN: MY_TOKEN - QOD_CATEGORY: inspire - FONT: AmaticSC - TEST_CHARACTER: a diff --git a/inkyshot/update-display.py b/inkyshot/update-display.py index f2b55e0..f80740b 100644 --- a/inkyshot/update-display.py +++ b/inkyshot/update-display.py @@ -279,7 +279,7 @@ def temp_to_str(temp, scale): BALENA_DEVICE_UUID = os.environ["BALENA_DEVICE_UUID"] BALENA_SUPERVISOR_ADDRESS = os.environ["BALENA_SUPERVISOR_ADDRESS"] BALENA_SUPERVISOR_API_KEY = os.environ["BALENA_SUPERVISOR_API_KEY"] -QUOTE_API_TOKEN = os.environ["QUOTE_API_TOKEN"] +QOD_API_TOKEN = os.environ["QOD_API_TOKEN"] WAVESHARE = True if "WAVESHARE" in os.environ else False @@ -354,7 +354,7 @@ def temp_to_str(temp, scale): try: response = requests.get( f"https://quotes.rest/qod?category={CATEGORY}&language={LANGUAGE}", - headers = {"Accept": "application/json", "Authorization": f"Bearer {QUOTE_API_TOKEN}"} + headers = {"Accept": "application/json", "Authorization": f"Bearer {QOD_API_TOKEN}"} ) data = response.json() message = data['contents']['quotes'][0]['quote']