Skip to content

Commit c920305

Browse files
authored
Merge pull request #63 from brentru/check-response-status-code
Check the response status code before parsing time, raise more verbose error
2 parents 7cbb3e8 + a153e37 commit c920305

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

adafruit_pyportal.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ def get_local_time(self, location=None):
620620
api_url += TIME_SERVICE_STRFTIME
621621
try:
622622
response = requests.get(api_url)
623+
if response.status_code != 200:
624+
raise ValueError(response.text)
623625
if self._debug:
624626
print("Time request: ", api_url)
625627
print("Time reply: ", response.text)

0 commit comments

Comments
 (0)