From ea4885acf792da988d026a61e9aa04862667bcd8 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 27 Aug 2023 22:09:27 +0200 Subject: [PATCH] Fix ElementTree DeprecationWarning when testing truth value (3.12) (#1209) * Fix ElementTree DeprecationWarning when testing truth value (3.12) * Use is None check * Update more locations --- plexapi/client.py | 2 +- plexapi/myplex.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plexapi/client.py b/plexapi/client.py index 2b4283c7..2aebc270 100644 --- a/plexapi/client.py +++ b/plexapi/client.py @@ -94,7 +94,7 @@ class PlexClient(PlexObject): raise Unsupported('Cannot reload an object not built from a URL.') self._initpath = self.key data = self.query(self.key, timeout=timeout) - if not data: + if data is None: raise NotFound(f"Client not found at {self._baseurl}") if self._clientIdentifier: client = next( diff --git a/plexapi/myplex.py b/plexapi/myplex.py index d533be4d..45f1fb80 100644 --- a/plexapi/myplex.py +++ b/plexapi/myplex.py @@ -1790,7 +1790,7 @@ class MyPlexPinLogin: params = None response = self._query(url, self._session.post, params=params) - if not response: + if response is None: return None self._id = response.attrib.get('id') @@ -1807,7 +1807,7 @@ class MyPlexPinLogin: url = self.CHECKPINS.format(pinid=self._id) response = self._query(url) - if not response: + if response is None: return False token = response.attrib.get('authToken')