From 5efcbc2d2bff2ad2e8196bbc88c0e8c802d43eea Mon Sep 17 00:00:00 2001 From: Quentame Date: Wed, 4 Mar 2020 00:03:14 +0100 Subject: [PATCH] Fix response is not defined (#233) --- pyicloud/base.py | 2 +- pyicloud/exceptions.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyicloud/base.py b/pyicloud/base.py index 87fa533..da1246a 100644 --- a/pyicloud/base.py +++ b/pyicloud/base.py @@ -114,7 +114,7 @@ class PyiCloudSession(requests.Session): def _raise_error(self, code, reason): if self.service.requires_2sa and \ reason == 'Missing X-APPLE-WEBAUTH-TOKEN cookie': - raise PyiCloud2SARequiredError(response.url) + raise PyiCloud2SARequiredError(self.service.user['apple_id']) if code == 'ZONE_NOT_FOUND' or code == 'AUTHENTICATION_FAILED': reason = 'Please log into https://icloud.com/ to manually ' \ 'finish setting up your iCloud service' diff --git a/pyicloud/exceptions.py b/pyicloud/exceptions.py index f3cadea..8a65a54 100644 --- a/pyicloud/exceptions.py +++ b/pyicloud/exceptions.py @@ -25,8 +25,8 @@ class PyiCloudFailedLoginException(PyiCloudException): class PyiCloud2SARequiredError(PyiCloudException): - def __init__(self, url): - message = "Two-step authentication required for %s" % url + def __init__(self, apple_id): + message = "Two-step authentication required for account: %s" % apple_id super(PyiCloud2SARequiredError, self).__init__(message)