Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for 450 reauthentication failure bug #372

Merged
merged 4 commits into from
Feb 16, 2022
Merged

Conversation

gcobb321
Copy link
Contributor

Breaking change

Proposed change

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New service (thank you!)
  • New feature (which adds functionality to an existing service)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests
  • Documentation or code sample

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated to README

@gcobb321 gcobb321 changed the title Update base.py Fix 450 reauthentication failure bug Feb 15, 2022
@gcobb321 gcobb321 changed the title Fix 450 reauthentication failure bug Fix for 450 reauthentication failure bug Feb 15, 2022
pyicloud/base.py Outdated
@@ -112,7 +112,10 @@ def request(self, method, url, **kwargs): # pylint: disable=arguments-differ
# Handle re-authentication for Find My iPhone
LOGGER.debug("Re-authenticating Find My iPhone service")
try:
self.service.authenticate(True, "find")
# If 450, authentication requires a full sign in to the account
service = None if response.status_code == 450 else 'find'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always status code 450 here because that's checked in the above if-statement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for a response.code 450 should actually include a check for the other response codes also requiring a reauthentication (421 & 500), not just a 450. Updated PR submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants