pyicloud/pyicloud/exceptions.py
Tor Arne Vestbø 7ec72a1625 Add support for two-factor authentication
When 2FA is enabled in iCloud most iCloud services are unavailable
without first going through the 2FA handshake. We now have API to
initiate the 2FA, which can be used by more advanced API clients.

The built in command line 'icloud' application has not been updated,
as listing and managing devices though Find my iPhone is one of the
services that do not require 2FA.

Fixes issue #66.
2016-02-25 13:33:05 +01:00

36 lines
799 B
Python

class PyiCloudException(Exception):
pass
class PyiCloudNoDevicesException(PyiCloudException):
pass
class PyiCloudAPIResponseError(PyiCloudException):
def __init__(self, reason, code):
self.reason = reason
self.code = code
message = reason
if code:
message += " (%s)" % code
super(PyiCloudAPIResponseError, self).__init__(message)
class PyiCloudFailedLoginException(PyiCloudException):
pass
class PyiCloud2FARequiredError(PyiCloudException):
def __init__(self, url):
message = "Two-factor authentication required for %s" % url
super(PyiCloud2FARequiredError, self).__init__(message)
class PyiCloudNoDevicesException(Exception):
pass
class NoStoredPasswordAvailable(PyiCloudException):
pass