demo_requests_head_headers.py:
import requests url = 'https://www.begtut.com/python/demopage.html' #use the 'headers' parameter to set the HTTP headers: x = requests.head(url, headers = {"HTTP_HOST": "MyVeryOwnHost"}) print(x.status_code)
➜ begtut>python demo_requests_head_headers.py
200