Skip to content

Commit 868dd5e

Browse files
authored
Merge pull request #50 from anecdata/master
Make timeout a keyword argument
2 parents ac4aee5 + c25157e commit 868dd5e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_esp32spi/adafruit_esp32spi_requests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def iter_content(self, chunk_size=1, decode_unicode=False):
129129
return
130130

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

166-
sock.settimeout(1) # 1 second timeout
166+
sock.settimeout(timeout) # socket read timeout
167167

168168
try:
169169
if proto == "https:":

0 commit comments

Comments
 (0)