Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pydrive2/test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ def _call_once(call, *args, **kwargs):
try:
return call(*args, **kwargs)
except ApiRequestError as exception:
if exception.error["code"] in [403, 500, 502, 503, 504]:
raise PyDriveRetriableError("Google API request failed")
code = exception.error["code"]
# Drive sometimes answers 409 Conflict to a delete right after the
# file changed.
conflict = code == 409 and exception.GetField("reason") == "conflict"
if conflict or code in [403, 500, 502, 503, 504]:
raise PyDriveRetriableError(
f"Google API request failed: {exception}"
) from exception
raise


Expand Down