From e3c07177bd9e0e25452e3506603a393e0f408d54 Mon Sep 17 00:00:00 2001 From: Sloot Date: Tue, 10 Nov 2020 23:12:21 -0500 Subject: [PATCH 1/3] added check to see if location was not supplied before getting timezone from secrets --- adafruit_matrixportal/network.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adafruit_matrixportal/network.py b/adafruit_matrixportal/network.py index 2f3aa71..c7625eb 100755 --- a/adafruit_matrixportal/network.py +++ b/adafruit_matrixportal/network.py @@ -177,7 +177,8 @@ def get_local_time(self, location=None): "\n\nOur time service requires a login/password to rate-limit. Please register for a free adafruit.io account and place the user/key in your secrets file under 'aio_username' and 'aio_key'" # pylint: disable=line-too-long ) from KeyError - location = secrets.get("timezone", location) + if location is None: + location = secrets.get("timezone") if location: print("Getting time for timezone", location) api_url = (TIME_SERVICE + "&tz=%s") % (aio_username, aio_key, location) From 451f5a8037cef2177200e69304cb595b041b9d1a Mon Sep 17 00:00:00 2001 From: Sloot Date: Mon, 16 Nov 2020 20:29:08 -0500 Subject: [PATCH 2/3] minor change to force pre-commit to do something --- adafruit_matrixportal/network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_matrixportal/network.py b/adafruit_matrixportal/network.py index c7625eb..e1fb222 100755 --- a/adafruit_matrixportal/network.py +++ b/adafruit_matrixportal/network.py @@ -178,7 +178,7 @@ def get_local_time(self, location=None): ) from KeyError if location is None: - location = secrets.get("timezone") + location =secrets.get("timezone") if location: print("Getting time for timezone", location) api_url = (TIME_SERVICE + "&tz=%s") % (aio_username, aio_key, location) From b653b88c1c963ab0a1da98111fdf6e48ac3be619 Mon Sep 17 00:00:00 2001 From: Sloot Date: Mon, 16 Nov 2020 20:32:42 -0500 Subject: [PATCH 3/3] have now run pre-commit --- adafruit_matrixportal/network.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_matrixportal/network.py b/adafruit_matrixportal/network.py index e1fb222..7384f30 100755 --- a/adafruit_matrixportal/network.py +++ b/adafruit_matrixportal/network.py @@ -177,8 +177,8 @@ def get_local_time(self, location=None): "\n\nOur time service requires a login/password to rate-limit. Please register for a free adafruit.io account and place the user/key in your secrets file under 'aio_username' and 'aio_key'" # pylint: disable=line-too-long ) from KeyError - if location is None: - location =secrets.get("timezone") + if location is None: + location = secrets.get("timezone") if location: print("Getting time for timezone", location) api_url = (TIME_SERVICE + "&tz=%s") % (aio_username, aio_key, location)