Catch top-level RequestException from requests
MODIFY
plex_trakt_sync/decorators/rate_limit.py
plex_trakt_sync/decorators/rate_limit.py
from functools import wraps
from time import sleep
-from requests import ReadTimeout
-from requests.exceptions import ConnectionError
+from requests import RequestException
from trakt.errors import RateLimitException, TraktInternalException
from plex_trakt_sync.logging import logger
@@ -21,7 +20,7 @@ def wrapper(*args, **kwargs):
while True:
try:
return fn(*args, **kwargs)
- except (RateLimitException, ConnectionError, ReadTimeout, TraktInternalException) as e:
+ except (RateLimitException, RequestException, TraktInternalException) as e:
if retry == retries:
raise e

MODIFY
plex_trakt_sync/media.py
plex_trakt_sync/media.py
from plexapi.exceptions import NotFound
-from requests.exceptions import ConnectionError
+from requests import RequestException
from trakt.errors import TraktException
from plex_trakt_sync.logging import logger
@@ -118,7 +118,7 @@ def resolve(self, pm: PlexLibraryItem, tm=None):
tm = self.trakt.find_episode(tm, pm)
else:
tm = self.trakt.find_by_media(pm)
- except (TraktException, ConnectionError) as e:
+ except (TraktException, RequestException) as e:
logger.warning(f"Skipping {pm}: Trakt errors: {e}")
return None

Catch top-level RequestException from requests