Google Drive SDK - 500: internal server error: downloading files in most cases

The Google Drive REST API sometimes returns 500: Internal server error while trying to download a file. Most of these errors actually correspond to a successful download. We repeat the download as recommended by Google, only to view duplicates later.

What is the recommended way to pass these errors?

+5
source share
2 answers

The Google documentation seems to indicate that this is an internal error, not a specific error that you can fix. They suggest using exponential shutdown , which basically repeats a function attempt with increasing intervals.

, . 2 . , 4 . 8 , 16, 32 .. , . , 10 .

retrying . from retrying import retry, retry , . :

@retry(wait_exponential_multiplier=1000, wait_exponential_max=60*1000, stop_max_delay=10*60*1000)
def find_file(name, parent=''):
    ...

, @retry . retry(), , , . wait_exponential_multiplier . wait_exponential_max - , . stop_max_delay - , , . .

0
-2

All Articles