Skip to content

Commit

Permalink
Merge pull request #9 from brentru/switch-read
Browse files Browse the repository at this point in the history
Use socket.recv
  • Loading branch information
ladyada committed Aug 29, 2019
2 parents 56d7643 + 341a880 commit 31d7845
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adafruit_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def content(self):
# print("Content length:", content_length)
if self._cached is None:
try:
self._cached = self.socket.read(content_length)
self._cached = self.socket.recv(content_length)
finally:
self.socket.close()
self.socket = None
Expand Down Expand Up @@ -138,7 +138,7 @@ def iter_content(self, chunk_size=1, decode_unicode=False):
raise NotImplementedError("Unicode not supported")

while True:
chunk = self.socket.read(chunk_size)
chunk = self.socket.recv(chunk_size)
if chunk:
yield chunk
else:
Expand Down

0 comments on commit 31d7845

Please sign in to comment.