Skip to content

Commit

Permalink
Merge pull request #43 from makermelissa/master
Browse files Browse the repository at this point in the history
Fixed the Expected 01 but got 00 error
  • Loading branch information
makermelissa authored Oct 29, 2020
2 parents 46007a6 + 5a1a35b commit a2ec2a9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions adafruit_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def _get_socket(self, host, port, proto, *, timeout=1):
sock.settimeout(timeout) # socket read timeout
ok = True
try:
sock.connect((connect_host, port))
ok = sock.connect((connect_host, port))
except MemoryError:
if not any(self._socket_free.items()):
raise
Expand Down Expand Up @@ -587,7 +587,11 @@ def __init__(self, socket, tls_mode):

def connect(self, address):
"""connect wrapper to add non-standard mode parameter"""
return self._socket.connect(address, self._mode)
try:
self._socket.connect(address, self._mode)
return True
except RuntimeError:
return False


class _FakeSSLContext:
Expand Down

0 comments on commit a2ec2a9

Please sign in to comment.