Detect 'errorReason' in error messages from iCloud API

This commit is contained in:
Tor Arne Vestbø 2016-10-10 01:18:49 +02:00
parent 7d57f06bb1
commit ced8e83a40

View file

@ -79,7 +79,9 @@ class PyiCloudSession(requests.Session):
logger.debug(json)
reason = json.get('errorMessage') or json.get('reason')
reason = json.get('errorMessage')
reason = reason or json.get('reason')
reason = reason or json.get('errorReason')
if not reason and isinstance(json.get('error'), six.string_types):
reason = json.get('error')
if not reason and not response.ok: