From e45243f02429b3e309899c81c6174bbe4e32f702 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 9 Apr 2024 13:16:12 -0400 Subject: [PATCH] Update Dashblock_API to settings.toml --- PyPortal/Dashblock_API/code.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/PyPortal/Dashblock_API/code.py b/PyPortal/Dashblock_API/code.py index cefebb46e..761ce4220 100644 --- a/PyPortal/Dashblock_API/code.py +++ b/PyPortal/Dashblock_API/code.py @@ -8,19 +8,13 @@ Use Dashblock to create a custom API for learn.adafruit.com, then display the number of learn guides on the site """ +import os import time import board from adafruit_pyportal import PyPortal -# Get wifi details and more from a secrets.py file -try: - from secrets import secrets -except ImportError: - print("WiFi settings are kept in settings.py, please add them there!") - raise - # Set up where we'll be fetching data from -DATA_SOURCE = "https://api.dashblock.io/model/v1?api_key=" + secrets['dashblock_key'] +DATA_SOURCE = "https://api.dashblock.io/model/v1?api_key=" + os.getenv("DASHBLOCK_KEY") GUIDE_COUNT = ['entities', 0, 'guide count'] CAPTION = 'total tutorials:'