Fix Slides F+, Add multi err code support

Error codes module expanded to support arrays of error codes rather than only one.
Using this new functionality, Slides was set to error codes 404 (as standard) AND 204 (non standard), to accomodate for that website's odd edge case.
pull/2068/head
Paul Pfeister 1 month ago
parent eb89787dcd
commit e6d0f1ee7b

@ -1757,6 +1757,7 @@
"username_claimed": "blue"
},
"Slides": {
"errorCode": [204, 404],
"errorType": "status_code",
"url": "https://slides.com/{}",
"urlMain": "https://slides.com/",

@ -351,7 +351,6 @@ def sherlock(
# Get the expected error type
error_type = net_info["errorType"]
error_code = net_info.get("errorCode")
# Retrieve future and ensure it has finished
future = net_info["request_future"]
@ -407,14 +406,19 @@ def sherlock(
else:
query_status = QueryStatus.AVAILABLE
elif error_type == "status_code":
# Checks if the Status Code is equal to the optional "errorCode" given in 'data.json'
if error_code == r.status_code:
query_status = QueryStatus.AVAILABLE
query_status = QueryStatus.AVAILABLE
error_codes = net_info.get("errorCode")
if error_codes: # (if set in data.json)
if isinstance(error_codes, int):
if error_codes != r.status_code:
query_status = QueryStatus.CLAIMED
else:
if r.status_code not in error_codes:
query_status = QueryStatus.CLAIMED
# Checks if the status code of the response is 2XX
elif not r.status_code >= 300 or r.status_code < 200:
query_status = QueryStatus.CLAIMED
else:
query_status = QueryStatus.AVAILABLE
elif error_type == "response_url":
# For this detection method, we have turned off the redirect.
# So, there is no need to check the response URL: it will always

Loading…
Cancel
Save