Can
pass
out all,and only do a check for 200.import requests from requests.exceptions import RequestException url1 = "http://www.not_exist.com/" url2 = "https://httpbin.org/status/500" url3 = "https://httpbin.org/delay/15" url4 = 'https://www.google.com/' # ok try: response = requests.get(url4, timeout=10) if response.status_code == 200: print(response.status_code) # All ok 200 except RequestException: pass