From a153e37fc0bda0e66e134969d3565daf29d4cb99 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 28 Jan 2020 11:35:20 -0500 Subject: [PATCH] check status code, raise valuerror --- adafruit_pyportal.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adafruit_pyportal.py b/adafruit_pyportal.py index 8ba3365..802069e 100644 --- a/adafruit_pyportal.py +++ b/adafruit_pyportal.py @@ -620,6 +620,8 @@ def get_local_time(self, location=None): api_url += TIME_SERVICE_STRFTIME try: response = requests.get(api_url) + if response.status_code != 200: + raise ValueError(response.text) if self._debug: print("Time request: ", api_url) print("Time reply: ", response.text)