Skip to content

Commit

Permalink
retry TimeoutError in google sheets api
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Feb 13, 2024
1 parent 6e22901 commit eee1578
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions recipes/DocExtract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit eee1578

Please sign in to comment.