Skip to content

Make timeout a keyword argument #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2019
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