1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-26 12:42:29 +01:00

[common] simplify 'status_code' check in Extractor.request()

This commit is contained in:
Mike Fährmann 2024-04-16 18:37:59 +02:00
parent 68f4208251
commit 923c6f3214
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -177,9 +177,10 @@ class Extractor():
code = response.status_code
if self._write_pages:
self._dump_response(response)
if 200 <= code < 400 or fatal is None and \
(400 <= code < 500) or not fatal and \
(400 <= code < 429 or 431 <= code < 500):
if (
code < 400 or
code < 500 and (not fatal and code != 429 or fatal is None)
):
if encoding:
response.encoding = encoding
return response