From 6a791b2be065521c7437be9313d4232f2b8ec7a6 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Wed, 8 Jan 2025 09:59:27 -0500 Subject: [PATCH] Added TooManyRequests throttling to podnapisi provider. --- custom_libs/subliminal_patch/providers/podnapisi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/custom_libs/subliminal_patch/providers/podnapisi.py b/custom_libs/subliminal_patch/providers/podnapisi.py index 5785570e1..c4ec284c0 100644 --- a/custom_libs/subliminal_patch/providers/podnapisi.py +++ b/custom_libs/subliminal_patch/providers/podnapisi.py @@ -17,6 +17,8 @@ from requests.adapters import HTTPAdapter from subliminal.utils import sanitize from subliminal_patch.subtitle import guess_matches from subliminal_patch.providers.mixins import ProviderSubtitleArchiveMixin +from subliminal_patch.exceptions import TooManyRequests + try: from lxml import etree @@ -205,6 +207,8 @@ class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin): content = self.session.get(self.server_url + 'search/old', params=params, timeout=30).content xml = etree.fromstring(content) except etree.ParseError: + if '429 Too Many Requests' in content: + raise TooManyRequests logger.error("Wrong data returned: %r", content) break