Catch exception when returned session error is not structured as expected
see
@@ -457,10 +457,14 @@ class GetUploadSession(MmCall):
return (True, None)
if 'errorMessage' in res:
+ try:
# This terribly nested structure is Google's doing.
error_code = (res['errorMessage']['additionalInfo']
- ['uploader_service.GoogleRupioAdditionalInfo']
- ['completionInfo']['customerSpecificInfo']['ResponseCode'])
+ ['uploader_service.GoogleRupioAdditionalInfo']['completionInfo']
+ ['customerSpecificInfo']['ResponseCode'])
+ except KeyError:
+ # The returned nested structure is not as expected: cannot get Response Code
+ error_code = None
got_session = False
