1import requests
2
3URL = "https://api.github.com"
4
5try:
6 response = requests.head(URL)
7except Exception as e:
8 print(f"NOT OK: {str(e)}")
9else:
10 if response.status_code == 200:
11 print("OK")
12 else:
13 print(f"NOT OK: HTTP response code {response.status_code}")
14