Fix status_code logic bug

pull/2068/head
Paul Pfeister 9 months ago
parent da3c90fce8
commit 060088f7a1

@ -1280,7 +1280,7 @@
"username_claimed": "blue" "username_claimed": "blue"
}, },
"Minecraft": { "Minecraft": {
"errorCode": [204, 404, 405], "errorCode": 204,
"errorType": "status_code", "errorType": "status_code",
"url": "https://api.mojang.com/users/profiles/minecraft/{}", "url": "https://api.mojang.com/users/profiles/minecraft/{}",
"urlMain": "https://minecraft.net/", "urlMain": "https://minecraft.net/",
@ -1763,7 +1763,7 @@
"username_claimed": "blue" "username_claimed": "blue"
}, },
"Slides": { "Slides": {
"errorCode": [204, 404], "errorCode": 204,
"errorType": "status_code", "errorType": "status_code",
"url": "https://slides.com/{}", "url": "https://slides.com/{}",
"urlMain": "https://slides.com/", "urlMain": "https://slides.com/",

@ -406,19 +406,17 @@ def sherlock(
else: else:
query_status = QueryStatus.AVAILABLE query_status = QueryStatus.AVAILABLE
elif error_type == "status_code": elif error_type == "status_code":
query_status = QueryStatus.AVAILABLE
error_codes = net_info.get("errorCode") error_codes = net_info.get("errorCode")
query_status = QueryStatus.CLAIMED
if error_codes: # (if set in data.json) # Type consistency, allowing for both singlets and lists in manifest
if isinstance(error_codes, int): if isinstance(error_codes, int):
if error_codes != r.status_code: error_codes = [error_codes]
query_status = QueryStatus.CLAIMED
else: if r.status_code in error_codes:
if r.status_code not in error_codes: query_status = QueryStatus.AVAILABLE
query_status = QueryStatus.CLAIMED elif r.status_code >= 300 or r.status_code < 200:
# Checks if the status code of the response is 2XX query_status = QueryStatus.AVAILABLE
elif not r.status_code >= 300 or r.status_code < 200:
query_status = QueryStatus.CLAIMED
elif error_type == "response_url": elif error_type == "response_url":
# For this detection method, we have turned off the redirect. # For this detection method, we have turned off the redirect.
# So, there is no need to check the response URL: it will always # So, there is no need to check the response URL: it will always

Loading…
Cancel
Save