diff --git a/recipes/DocExtract.py b/recipes/DocExtract.py index 621b94b94..6b0728646 100644 --- a/recipes/DocExtract.py +++ b/recipes/DocExtract.py @@ -487,9 +487,12 @@ def process_source( def google_api_should_retry(e: Exception) -> bool: - return isinstance(e, HttpError) and ( - e.resp.status in (408, 429) or e.resp.status > 500 - ) + from googleapiclient.errors import HttpError + + return ( + isinstance(e, HttpError) + and (e.resp.status in (408, 429) or e.resp.status > 500) + ) or isinstance(e, TimeoutError) @retry_if(google_api_should_retry)