Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions adafruit_esp32spi/adafruit_esp32spi_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def iter_content(self, chunk_size=1, decode_unicode=False):
return

# pylint: disable=too-many-branches, too-many-statements, unused-argument, too-many-arguments, too-many-locals
def request(method, url, data=None, json=None, headers=None, stream=False):
def request(method, url, data=None, json=None, headers=None, stream=False, timeout=1):
"""Perform an HTTP request to the given url which we will parse to determine
whether to use SSL ('https://') or not. We can also send some provided 'data'
or a json dictionary which we will stringify. 'headers' is optional HTTP headers
Expand Down Expand Up @@ -163,7 +163,7 @@ def request(method, url, data=None, json=None, headers=None, stream=False):
sock = socket.socket(addr_info[0], addr_info[1], addr_info[2])
resp = Response(sock) # our response

sock.settimeout(1) # 1 second timeout
sock.settimeout(timeout) # socket read timeout

try:
if proto == "https:":
Expand Down