AlexaPy 1.29.22__tar.gz → 1.29.23__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AlexaPy
3
- Version: 1.29.22
3
+ Version: 1.29.23
4
4
  Summary: Python API to control Amazon Echo Devices Programmatically.
5
5
  License: Apache-2.0
6
6
  License-File: AUTHORS.md
@@ -475,9 +475,13 @@ class AlexaLogin:
475
475
  await self._session._connector.close()
476
476
  self._session._connector = None
477
477
 
478
- async def reset(self) -> None:
478
+ async def reset(self, *, delete_cookies: bool = True) -> None:
479
479
  """Remove data related to existing login."""
480
- _LOGGER.debug("Resetting Login for %s - %s", hide_email(self.email), self.url)
480
+ _LOGGER.debug(
481
+ "Resetting Login for %s - %s",
482
+ hide_email(self.email),
483
+ self.url,
484
+ )
481
485
  await self.close()
482
486
  self._session = None
483
487
  self._data = None
@@ -489,9 +493,15 @@ class AlexaLogin:
489
493
  self._create_session()
490
494
  self._close_requested = False
491
495
 
492
- for cookiefile in self._cookiefile:
493
- if (cookiefile) and os.path.exists(cookiefile):
494
- await delete_cookie(cookiefile)
496
+ if delete_cookies:
497
+ _LOGGER.debug(
498
+ "Deleting cookies for %s - %s",
499
+ hide_email(self.email),
500
+ self.url,
501
+ )
502
+ for cookiefile in self._cookiefile:
503
+ if cookiefile and os.path.exists(cookiefile):
504
+ await delete_cookie(cookiefile)
495
505
 
496
506
  @classmethod
497
507
  def get_inputs(cls, soup: BeautifulSoup, searchfield=None) -> dict[str, str]:
@@ -679,7 +689,10 @@ class AlexaLogin:
679
689
  _LOGGER.debug("Using cookies to log in")
680
690
  if await self.test_loggedin(cookies):
681
691
  return
682
- await self.reset()
692
+ _LOGGER.debug(
693
+ "Cookie login failed; resetting session without deleting cookies"
694
+ )
695
+ await self.reset(delete_cookies=False)
683
696
  _LOGGER.debug("Using credentials to log in")
684
697
  if not self._site:
685
698
  site: URL = self.start_url
@@ -1,7 +1,7 @@
1
1
  # SPDX-License-Identifier: Apache-2.0
2
2
  [tool.poetry]
3
3
  name = "AlexaPy"
4
- version = "1.29.22"
4
+ version = "1.29.23"
5
5
  description = "Python API to control Amazon Echo Devices Programmatically."
6
6
  authors = [
7
7
  "Keaton Taylor <keatonstaylor@gmail.com>",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes