Skip if response status code isn't 200 or content-type isn't json

Signed-off-by: Odyssey <hi@odyssey346.dev>
This commit is contained in:
Odyssey
2023-04-02 12:40:34 +02:00
parent 1fc2a83baf
commit 7d4841eee3
+6
View File
@@ -49,6 +49,12 @@ for row in rows:
try:
r = requests.get(link + '/api/v1/version', headers=headers)
if r.status_code != 200:
print("Error while fetching " + link + '/api/v1/version. We got a ' + str(r.status_code) + ' status code. Skipping...')
continue
if r.headers['Content-Type'] != 'application/json':
print("Error while fetching " + link + '/api/v1/version. We got a ' + r.headers['Content-Type'] + ' content type. Skipping...')
continue
except:
print("Error while fetching " + link + '/api/v1/version. Skipping...')
continue