Skip to content

Commit 484158b

Browse files
author
brentru
committed
pylint!
1 parent c7d7360 commit 484158b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

adafruit_azureiot.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def _parse_http_status(status_code, status_reason):
7676
raise TypeError("Error {0}: {1}".format(status_code, status_reason))
7777

7878
def get_hub_message(self, device_id):
79-
"""Returns a message from a Microsoft Azure IoT Hub (Cloud-to-Device), or -1 if the message queue is empty.
79+
"""Returns a message from a Microsoft Azure IoT Hub (Cloud-to-Device), or -1
80+
if the message queue is empty.
8081
NOTE: HTTP Cloud-to-Device messages are throttled. Poll every 25 minutes, or more.
8182
:param int device_id: Device identifier.
8283
"""
@@ -92,13 +93,14 @@ def get_hub_message(self, device_id):
9293
reject_message = False
9394
# prepare the device-bound completion URL
9495
etag = etag.strip('\'"')
95-
path_complete = "{0}/devices/{1}/messages/deviceBound/{2}?api-version={3}".format(self._iot_hub_url, device_id, etag, AZ_API_VER)
96+
path_complete = "{0}/devices/{1}/messages/deviceBound/{2}?api-version={3}".format(
97+
self._iot_hub_url, device_id, etag, AZ_API_VER)
9698
if reject_message:
9799
path_complete += '&reject'
98100
del_status = self._delete(path_complete, is_c2d=True)
99-
if del_status == 204:
100-
return data[0]
101-
return -1
101+
if del_status == 204:
102+
return data[0]
103+
return -1
102104

103105
# Device Messaging
104106
def send_device_message(self, device_id, message):
@@ -169,7 +171,7 @@ def _post(self, path, payload, return_response=True):
169171
self._parse_http_status(response.status_code, response.reason)
170172
if return_response:
171173
return response.json()
172-
response.close()
174+
return response.text
173175

174176
def _get(self, path, is_c2d=False):
175177
"""HTTP GET

0 commit comments

Comments
 (0)