Python get headers with requests

Python 10 เม.ย. 2020
>>> import requests
>>> response = requests.head('http://example.com')
>>> response.headers
    {'connection': 'close',
 'content-encoding': 'gzip',
 'content-length': '606',
 'content-type': 'text/html; charset=UTF-8',
 'date': 'Fri, 11 Jan 2013 02:32:34 GMT',
 'last-modified': 'Fri, 04 Jan 2013 01:17:22 GMT',
 'server': 'Apache/2.2.3 (CentOS)',
 'vary': 'Accept-Encoding'}

ref: https://stackoverflow.com/questions/14270698/get-file-size-using-python-requests-while-only-getting-the-header

แท็ก

Onyx

Just a middle-aged programmer, Can do many things but not the most.