From 04867d4339b856510d372b7771f3dc7c373b127e 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] 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 7386d4b80..998d8ed1c 100644 --- a/fsspec/implementations/http.py +++ b/fsspec/implementations/http.py @@ -316,7 +316,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: @@ -326,7 +326,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)