From b792f65282ae041b8e719e429d0b0bca17f40980 Mon Sep 17 00:00:00 2001 From: Sam Levang <39069044+slevang@users.noreply.github.com> Date: Fri, 30 Apr 2021 09:54:26 -0400 Subject: [PATCH] make aiohttp ClientError retriable (#385) --- gcsfs/core.py | 9 ++++++++- gcsfs/utils.py | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcsfs/core.py b/gcsfs/core.py index b4e73b06..9f978d08 100644 --- a/gcsfs/core.py +++ b/gcsfs/core.py @@ -29,6 +29,7 @@ import weakref from requests.exceptions import RequestException, ProxyError +from aiohttp.client_exceptions import ClientError from fsspec.asyn import sync_wrapper, sync, AsyncFileSystem from fsspec.utils import stringify_path, setup_logging from fsspec.implementations.http import get_client @@ -533,7 +534,13 @@ async def _call( ) self.validate_response(status, contents, path, headers) break - except (HttpError, RequestException, GoogleAuthError, ChecksumError) as e: + except ( + HttpError, + RequestException, + GoogleAuthError, + ChecksumError, + ClientError, + ) as e: if ( isinstance(e, HttpError) and e.code == 400 diff --git a/gcsfs/utils.py b/gcsfs/utils.py index 90c5cc7d..4cb81665 100644 --- a/gcsfs/utils.py +++ b/gcsfs/utils.py @@ -1,5 +1,6 @@ import requests.exceptions import google.auth.exceptions +import aiohttp.client_exceptions class HttpError(Exception): @@ -36,6 +37,7 @@ class ChecksumError(Exception): requests.exceptions.SSLError, requests.exceptions.ContentDecodingError, google.auth.exceptions.RefreshError, + aiohttp.client_exceptions.ClientError, ChecksumError, )