Skip to content

Commit a00375b

Browse files
authored
Merge pull request #21 from brentru/close-responses
Close HTTP method responses
2 parents 5431e6c + 64ce5f6 commit a00375b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

adafruit_io/adafruit_io.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ def _post(self, path, payload):
510510
path, json=payload, headers=self._create_headers(self._aio_headers[0])
511511
)
512512
self._handle_error(response)
513-
return response.json()
513+
json_data = response.json()
514+
response.close()
515+
return json_data
514516

515517
def _get(self, path):
516518
"""
@@ -521,7 +523,9 @@ def _get(self, path):
521523
path, headers=self._create_headers(self._aio_headers[1])
522524
)
523525
self._handle_error(response)
524-
return response.json()
526+
json_data = response.json()
527+
response.close()
528+
return json_data
525529

526530
def _delete(self, path):
527531
"""
@@ -532,7 +536,9 @@ def _delete(self, path):
532536
path, headers=self._create_headers(self._aio_headers[0])
533537
)
534538
self._handle_error(response)
535-
return response.json()
539+
json_data = response.json()
540+
response.close()
541+
return json_data
536542

537543
# Data
538544
def send_data(self, feed_key, data, metadata=None, precision=None):

0 commit comments

Comments
 (0)