mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-01 04:22:07 +08:00
Improved opensubtitles.com server-side error handling
This commit is contained in:
parent
6e52ce2ecf
commit
46051646c6
1 changed files with 6 additions and 6 deletions
|
@ -177,7 +177,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
|
|||
raise AuthenticationError('Login failed: {}'.format(r.reason))
|
||||
elif r.status_code == 429:
|
||||
raise TooManyRequests()
|
||||
elif r.status_code == 503:
|
||||
elif 500 <= r.status_code <= 599:
|
||||
raise ProviderError(r.reason)
|
||||
else:
|
||||
raise ProviderError('Bad status code: {}'.format(r.status_code))
|
||||
|
@ -207,11 +207,11 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
|
|||
|
||||
if results.status_code == 429:
|
||||
raise TooManyRequests()
|
||||
elif results.status_code == 503:
|
||||
elif 500 <= results.status_code <= 599:
|
||||
raise ProviderError(results.reason)
|
||||
elif results.status_code == 429:
|
||||
raise TooManyRequests()
|
||||
elif results.status_code == 503:
|
||||
elif 500 <= results.status_code <= 599:
|
||||
raise ProviderError(results.reason)
|
||||
|
||||
# deserialize results
|
||||
|
@ -304,7 +304,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
|
|||
if res.status_code == 429:
|
||||
raise TooManyRequests()
|
||||
|
||||
elif res.status_code == 503:
|
||||
elif 500 <= res.status_code <= 599:
|
||||
raise ProviderError(res.reason)
|
||||
|
||||
subtitles = []
|
||||
|
@ -378,7 +378,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
|
|||
raise TooManyRequests()
|
||||
elif res.status_code == 406:
|
||||
raise DownloadLimitExceeded("Daily download limit reached")
|
||||
elif res.status_code == 503:
|
||||
elif 500 <= res.status_code <= 599:
|
||||
raise ProviderError(res.reason)
|
||||
else:
|
||||
try:
|
||||
|
@ -392,7 +392,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
|
|||
raise TooManyRequests()
|
||||
elif res.status_code == 406:
|
||||
raise DownloadLimitExceeded("Daily download limit reached")
|
||||
elif res.status_code == 503:
|
||||
elif 500 <= res.status_code <= 599:
|
||||
raise ProviderError(res.reason)
|
||||
|
||||
subtitle_content = r.content
|
||||
|
|
Loading…
Reference in a new issue