Result Size: 625 x 571
demo_requests_head.py:
x
 
import requests
#the required first parameter of the 'head' method is the 'url':
x = requests.head('https://www.w3schools.com/python/demopage.php')
#print the response headers (the HTTP headers of the requested file):
print(x.headers)
C:\Users\My Name>python demo_requests_head.py
{'Content-Encoding': 'gzip', 'Cache-Control': 'public', 'Content-Type': 'text/html', 'Date': 'Sun Aug 03 2025 08:42:45 GMT+0000 (Coordinated Universal Time)', 'Server': 'Microsoft-IIS/7.5', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'SAMEORIGIN', 'X-Powered-By': 'PHP/5-4-2. ASP.NET', 'Content-Length': '0'}