You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In get, post, etc., the logic is similar to the following:
def _get(self, path):
"""
GET data from Adafruit IO
:param str path: Formatted Adafruit IO URL from _compose_path
"""
response = self._http.get(
path, headers=self._create_headers(self._aio_headers[1])
)
self._handle_error(response)
json_data = response.json()
response.close()
return json_data
Note that in the case that self._handle_error() throws, the response is not closed.
By using with ... as response:, the response will be automatically closed. The explicit response.close() call can probably be removed too.
I raise this issue because @kattni in discord mentioned encountering an espidf.MemoryError while using Adafruit IO_HTTP to retrieve the current time. However, I don't know if this is actually the cause of her problem.
The text was updated successfully, but these errors were encountered:
In get, post, etc., the logic is similar to the following:
Note that in the case that
self._handle_error()
throws, the response is not closed.By using
with ... as response:
, the response will be automatically closed. The explicitresponse.close()
call can probably be removed too.I raise this issue because @kattni in discord mentioned encountering an espidf.MemoryError while using Adafruit IO_HTTP to retrieve the current time. However, I don't know if this is actually the cause of her problem.
The text was updated successfully, but these errors were encountered: