From db97bd1b4707cacc8975c37823e3932cb3803b0f Mon Sep 17 00:00:00 2001 From: Benedikt Best <63287233+btbest@users.noreply.github.com> Date: Fri, 23 May 2025 15:15:04 +0200 Subject: [PATCH] Add option to expose connection errors in httpfs.exists --- fsspec/implementations/http.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fsspec/implementations/http.py b/fsspec/implementations/http.py index 093fa29be..8fa6a129d 100644 --- a/fsspec/implementations/http.py +++ b/fsspec/implementations/http.py @@ -326,7 +326,7 @@ async def gen_chunks(): async with meth(self.encode_url(rpath), data=gen_chunks(), **kw) as resp: self._raise_not_found_for_status(resp, rpath) - async def _exists(self, path, **kwargs): + async def _exists(self, path, strict=False, **kwargs): kw = self.kwargs.copy() kw.update(kwargs) try: @@ -336,7 +336,10 @@ async def _exists(self, path, **kwargs): async with r: return r.status < 400 except aiohttp.ClientError: - return False + if strict: + raise + else: + return False async def _isfile(self, path, **kwargs): return await self._exists(path, **kwargs)