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'}


img
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容