From 6f0aa0360a830adfaae48b0b38b660df55e0f034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccolo=CC=80=20Zapponi?= Date: Mon, 9 Nov 2020 09:11:14 +0000 Subject: [PATCH] Added support to force auth refresh --- pyicloud/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyicloud/base.py b/pyicloud/base.py index 8afe54b..d7b8070 100644 --- a/pyicloud/base.py +++ b/pyicloud/base.py @@ -256,14 +256,14 @@ class PyiCloudService(object): self._files = None self._photos = None - def authenticate(self): + def authenticate(self, force_refresh=False): """ Handles authentication, and persists cookies so that subsequent logins will not cause additional e-mails from Apple. """ login_successful = False - if self.session_data.get("session_token"): + if self.session_data.get("session_token") and not force_refresh: LOGGER.debug("Checking session token validity") try: req = self.session.post(f"{self.SETUP_ENDPOINT}/validate", data="null")