Fix response is not defined (#233)

This commit is contained in:
Quentame 2020-03-04 00:03:14 +01:00 committed by GitHub
parent 5368081b6b
commit 5efcbc2d2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -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'

View file

@ -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)