Skip to content

Commit a2ec2a9

Browse files
authored
Merge pull request #43 from makermelissa/master
Fixed the Expected 01 but got 00 error
2 parents 46007a6 + 5a1a35b commit a2ec2a9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

adafruit_requests.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def _get_socket(self, host, port, proto, *, timeout=1):
422422
sock.settimeout(timeout) # socket read timeout
423423
ok = True
424424
try:
425-
sock.connect((connect_host, port))
425+
ok = sock.connect((connect_host, port))
426426
except MemoryError:
427427
if not any(self._socket_free.items()):
428428
raise
@@ -587,7 +587,11 @@ def __init__(self, socket, tls_mode):
587587

588588
def connect(self, address):
589589
"""connect wrapper to add non-standard mode parameter"""
590-
return self._socket.connect(address, self._mode)
590+
try:
591+
self._socket.connect(address, self._mode)
592+
return True
593+
except RuntimeError:
594+
return False
591595

592596

593597
class _FakeSSLContext:

0 commit comments

Comments
 (0)