Skip to content

Commit 2c1f65e

Browse files
author
brentru
committed
fix bug when getting ISO8601 datetime from server
1 parent 31efdf8 commit 2c1f65e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

adafruit_io/adafruit_io.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,18 @@ def _post(self, path, payload):
105105
self._handle_error(response)
106106
return response.json()
107107

108-
def _get(self, path):
108+
def _get(self, path, return_text=False):
109109
"""
110110
GET data from Adafruit IO
111111
:param str path: Formatted Adafruit IO URL from _compose_path
112+
:param bool return_text: Returns text instead of json
112113
"""
113114
response = self.wifi.get(
114115
path,
115116
headers=self.http_headers[1])
116117
self._handle_error(response)
118+
if return_text:
119+
return response.text
117120
return response.json()
118121

119122
def _delete(self, path):
@@ -251,4 +254,4 @@ def receive_time(self, time_type):
251254
:param string time_type: Type of time to be returned: millis, seconds, or ISO-8601
252255
"""
253256
path = 'https://io.adafruit.com/api/v2/time/{0}'.format(time_type)
254-
return self._get(path)
257+
return self._get(path, return_text=True)

0 commit comments

Comments
 (0)