Skip to content

Commit 6308676

Browse files
authored
Merge pull request #37 from petercorke/fix/iread-url-timeout
fix: add socket timeout to iread() URL fetches
2 parents eb14c89 + 6ff62b1 commit 6308676

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/machinevisiontoolbox/base/imageio.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ def iread(
10411041
headers={"User-Agent": "machinevisiontoolbox-python/1.0"},
10421042
)
10431043
try:
1044-
with urllib.request.urlopen(req, context=ctx) as resp:
1044+
with urllib.request.urlopen(req, context=ctx, timeout=10) as resp:
10451045
if resp.status != 200:
10461046
raise ValueError(f"HTTP {resp.status} fetching {filename}")
10471047
array = np.asarray(bytearray(resp.read()), dtype="uint8")

0 commit comments

Comments
 (0)