diff --git a/python/cog/files.py b/python/cog/files.py index 698ef57748..ce0bd47152 100644 --- a/python/cog/files.py +++ b/python/cog/files.py @@ -15,7 +15,7 @@ def upload_file(fh: io.IOBase, output_file_prefix: Optional[str] = None) -> str: if output_file_prefix is not None: name = getattr(fh, "name", "output") url = output_file_prefix + os.path.basename(name) - resp = requests.put(url, files={"file": fh}, timeout=None) + resp = requests.put(url, files={"file": fh}, timeout=5) resp.raise_for_status() return url diff --git a/python/cog/types.py b/python/cog/types.py index e1aacc696b..83a3374297 100644 --- a/python/cog/types.py +++ b/python/cog/types.py @@ -336,7 +336,7 @@ def __wrapped__(self) -> Any: except AttributeError: pass url = object.__getattribute__(self, "__url__") - resp = requests.get(url, stream=True, timeout=None) + resp = requests.get(url, stream=True, timeout=10) resp.raise_for_status() resp.raw.decode_content = True object.__setattr__(self, "__target__", resp.raw)