Skip to content

Commit

Permalink
Added TooManyRequests throttling to podnapisi provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Jan 8, 2025
1 parent d7259d3 commit 6a791b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_libs/subliminal_patch/providers/podnapisi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
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
Expand Down Expand Up @@ -205,6 +207,8 @@ def query(self, language, keyword, video, season=None, episode=None, year=None,
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

Expand Down

0 comments on commit 6a791b2

Please sign in to comment.