Exceptions¶
All exceptions raised by PyiCloud derive from PyiCloudException, so a single
except PyiCloudException block catches everything the library raises.
Library exceptions.
PyiCloudException
¶
Bases: Exception
Generic iCloud exception.
Source code in pyicloud/exceptions.py
12 13 | |
PyiCloudPasswordException
¶
Bases: PyiCloudException
Password exception.
Source code in pyicloud/exceptions.py
16 17 | |
PyiCloudServiceUnavailable
¶
Bases: PyiCloudException
Service unavailable exception.
Source code in pyicloud/exceptions.py
20 21 | |
TokenException
¶
Bases: PyiCloudException
Token exception.
Source code in pyicloud/exceptions.py
24 25 | |
PyiCloudAPIResponseException
¶
Bases: PyiCloudException
iCloud response exception.
Source code in pyicloud/exceptions.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
PyiCloudServiceNotActivatedException
¶
Bases: PyiCloudAPIResponseException
iCloud service not activated exception.
Source code in pyicloud/exceptions.py
52 53 | |
PyiCloudPCSTimeoutException
¶
Bases: PyiCloudAPIResponseException
Raised when PCS access could not be granted after all retries.
Source code in pyicloud/exceptions.py
56 57 | |
PyiCloudConnectionException
¶
Bases: PyiCloudAPIResponseException
Raised when iCloud could not be reached at all.
A connection error, DNS failure or timeout says nothing about whether the caller's credentials or session are still good, only that no answer came back. Callers need to tell the two apart because the remedies are opposite: a rejected password is fixed by asking the user to log in again, while an unreachable service is fixed by waiting and retrying.
Distinguishing it matters most during authentication, where every transport failure used to be reported as a failed login. A consumer acting on that asks the user to re-enter working credentials in the middle of an outage, and, if it stops polling until they do, stays down long after iCloud has come back.
Subclasses the generic response error so existing handlers keep catching
it, and carries no code because no HTTP response was received.
Source code in pyicloud/exceptions.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
PyiCloudEndpointGoneException
¶
Bases: PyiCloudAPIResponseException
Raised when Apple reports an endpoint as permanently gone (HTTP 410).
Apple withdraws endpoints without notice, and has done so more than once. A 410 means the endpoint this library calls no longer exists, so it signals that pyicloud needs updating rather than that the caller's request, credentials, or session were wrong.
Distinguishing it matters because the alternative is expensive: when the Photos upload endpoint was withdrawn it surfaced as a generic response error, and the reporter ruled out a stale session, an outdated client, a missing PCS handshake, the wrong dsid, and the wrong partition before concluding the endpoint itself had gone.
endpoint is a redacted host-and-path label safe to quote in a bug
report; the full URL and the response body are available on response
when one was captured.
Source code in pyicloud/exceptions.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
PyiCloudFailedLoginException
¶
Bases: PyiCloudException
iCloud failed login exception.
Source code in pyicloud/exceptions.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
PyiCloudAccountLockedException
¶
Bases: PyiCloudFailedLoginException
Apple rejected authentication because the account is locked.
The iCloud sign-in flow directs locked accounts to this unlock URL. Apple
determines the required verification steps. Replace
{url_encoded_apple_account} with the URL-encoded Apple Account:
https://iforgot.apple.com/password/verify/appleid?returnUrl=https%3A%2F%2Fwww.icloud.com%2F&prs_account_nm={url_encoded_apple_account}&unlock=true.
Source code in pyicloud/exceptions.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
PyiCloudAcceptTermsException
¶
Bases: PyiCloudException
iCloud accept terms exception.
Source code in pyicloud/exceptions.py
157 158 | |
PyiCloud2FARequiredException
¶
Bases: PyiCloudException
iCloud 2FA required exception.
Source code in pyicloud/exceptions.py
161 162 163 164 165 166 167 168 | |
PyiCloud2SARequiredException
¶
Bases: PyiCloudException
iCloud 2SA required exception.
Source code in pyicloud/exceptions.py
171 172 173 174 175 176 177 | |
PyiCloudAuthRequiredException
¶
Bases: PyiCloudException
iCloud re-authentication required exception.
Source code in pyicloud/exceptions.py
180 181 182 183 184 185 186 187 | |
PyiCloudNoTrustedNumberAvailable
¶
Bases: PyiCloudException
iCloud no trusted number exception.
Source code in pyicloud/exceptions.py
190 191 | |
PyiCloudTrustedDevicePromptException
¶
Bases: PyiCloudAPIResponseException
Trusted-device prompt bootstrap exception.
Source code in pyicloud/exceptions.py
194 195 | |
PyiCloudTrustedDeviceVerificationException
¶
Bases: PyiCloudAPIResponseException
Trusted-device bridge verification exception.
Source code in pyicloud/exceptions.py
198 199 | |
PyiCloudTrustedDeviceChallengeRequiredException
¶
Bases: PyiCloudTrustedDeviceVerificationException
The active 2FA challenge is unusable and a replacement must be requested.
Raised when a trusted-device bridge challenge has been consumed or cannot be verified. Retrying without a fresh challenge would silently fall back to the legacy verifier, so callers should request and deliver a new code first.
Source code in pyicloud/exceptions.py
202 203 204 205 206 207 208 209 210 | |
PyiCloudSecurityKeyException
¶
Bases: PyiCloudException
Security key confirmation exception.
Source code in pyicloud/exceptions.py
213 214 | |
PyiCloudSecurityKeyTimeoutException
¶
Bases: PyiCloudSecurityKeyException
Security key confirmation cancelled or timed out before the key was touched.
Source code in pyicloud/exceptions.py
217 218 | |
PyiCloudNoStoredPasswordAvailableException
¶
Bases: PyiCloudException
iCloud no stored password exception.
Source code in pyicloud/exceptions.py
221 222 | |
PyiCloudNoDevicesException
¶
Bases: PyiCloudException
iCloud no device exception.
Source code in pyicloud/exceptions.py
226 227 | |