Exemple #1
0
    def _raise_error(self, code, reason):
        if self.service.requires_2sa and \
                reason == 'Missing X-APPLE-WEBAUTH-TOKEN cookie':
            raise PyiCloud2SARequiredError(response.url)

        if code == 'ZONE_NOT_FOUND' or code == 'AUTHENTICATION_FAILED':
            reason = 'Please log into https://icloud.com/ to manually ' \
                'finish setting up your iCloud service'
            api_error = PyiCloudServiceNotActivatedErrror(reason, code)
            logger.error(api_error)
            raise (api_error)

        if code == 'ACCESS_DENIED':
            reason = reason + '.  Please wait a few minutes then try ' \
                'again.  The remote servers might be trying to ' \
                'throttle requests.'

        api_error = PyiCloudAPIResponseError(reason, code)
        logger.error(api_error)
        raise (api_error)
 def mock_raise_response_error(offset):
     raise PyiCloudAPIResponseError("Invalid global session", 100)