import requests
url = 'https://www.w3schools.com/python/demopage.asp'
#use the 'headers' parameter to set the HTTP headers:
x = requests.head(url, headers = {"HTTP_HOST": "MyVeryOwnHost"})
print(x.status_code)