picklepete / pyicloud

A Python + iCloud wrapper to access iPhone and Calendar data.
MIT License
2.45k stars 437 forks source link

Incorrect password yields confusing "Missing apple_id field" error #423

Open danielschenk opened 1 year ago

danielschenk commented 1 year ago

The problem

Using an incorrect password produces the exception shown below, mentioning a missing field. This is confusing and had me start a search for possible causes, not thinking about something as obvious as a wrong password. Therefore, if possible, the error should be improved.

Environment

Traceback/Error logs

  File "/Users/danielschenk/git/ibackup/.venv/lib/python3.10/site-packages/pyicloud/base.py", line 271, in __init__
    self.authenticate()
  File "/Users/danielschenk/git/ibackup/.venv/lib/python3.10/site-packages/pyicloud/base.py", line 335, in authenticate
    self._authenticate_with_token()
  File "/Users/danielschenk/git/ibackup/.venv/lib/python3.10/site-packages/pyicloud/base.py", line 357, in _authenticate_with_token
    raise PyiCloudFailedLoginException(msg, error) from error
pyicloud.exceptions.PyiCloudFailedLoginException: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))

Additional information