Add tenacity retry for JSONDecodeError.

This commit is contained in:
voussoir 2021-08-31 02:30:53 -07:00
parent 78cb1706ed
commit 57b7b08101
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -46,7 +46,8 @@ class Mega:
self.requests_session = requests.Session() self.requests_session = requests.Session()
@tenacity.retry( @tenacity.retry(
retry=tenacity.retry_if_exception_type(errors.EAGAIN), retry=tenacity.retry_if_exception_type((errors.EAGAIN, json.decoder.JSONDecodeError)),
stop=tenacity.stop_after_attempt(10),
wait=tenacity.wait_exponential(multiplier=2, min=2, max=60), wait=tenacity.wait_exponential(multiplier=2, min=2, max=60),
) )
def _api_request(self, request_data, params={}): def _api_request(self, request_data, params={}):