Python Requests.head()


以很少网络流量获得概要信息

>>> url = "http://wx4.sinaimg.cn/large/d030806aly1fq1vn8j0ajj21ho28bduy.jpg"
>>> rsp = requests.head(url)
>>> rsp.headers

{'Server': 'nginx', 'Date': 'Thu, 02 Aug 2018 12:48:36 GMT', 'Content-Type': 
'image/jpeg', 'Content-Length': '567754', 'Connection': 'keep-alive', 'x-debug-hit': 
'sto(567754,0.043)', 'Pragma': 'public', 'Cache-Control': 'max-age=7776000', 'Last-
Modified': 'Mon, 08 Jul 2013 18:06:40 GMT', 'Expires': 'Wed, 31 Oct 2018 04:48:04 
GMT', 'X-Request-ID': 'g4.27-1533185284.416000-690879452', 'Age': '28832', 
'LB_HEADER': 'wbtngx.29.wbg1.shx.lb.sinanode.com', 'Via': 'http/1.1 
ctc.ningbo.ha2ts4.73 (ApacheTrafficServer/6.2.1 [cMsSfW]), http/1.1 
ctc.qingdao.ha2ts4.31 (ApacheTrafficServer/6.2.1 [cHs f ])', 'Access-Control-Allow-
Origin': '', 'X-Via-Edge': '15332141163741b9929b63105f98c45e1f2e3', 'X-Cache': 
'HIT.31', 'X-Via-CDN': 
'f=edge,s=ctc.qingdao.ha2ts4.33.nb.sinaedge.com,c=182.41.153.27;
f=Edge,s=ctc.qingdao.ha2ts4.31,c=140.249.5.33'}


Python Requests.head()_第1张图片
img

你可能感兴趣的:(Python Requests.head())