首页 Python通用模块视频教程 http请求头中重要请求元素讲解
pay pay

http请求头中重要请求元素讲解

日期: 五月 5, 2023, 12:38 p.m.
阅读: 108
作者: Python自学网-村长

摘要: http请求头中重要请求元素讲解

'''请求头
cookie:用于存放缓存的cookie信息
Host:是服务器的主机名和端口号(域名或IP)
Connection:客户端和服务器之间的链接类型,起到重用链接,缩短响应时间的同时减少资源损耗(keep-alive保持连接或close关闭连接)
Upgrade-Insecure-Requests:升级不安全请求,如果服务器支持会把http重定向到https上(值为1表示服务器支持重定向)
Accept:浏览器支持的MIME类型文件,可以指定接受类型(html,css,js,image...),也可以接受所有格式(*/*)
Accept-Encoding:支持压缩或编码等格式
Accept-Language:支持语言
# 在保证客户端得到的数据是最新数据的前提下尽量减少请求次数,比如图片资源在刷新时不请求,直接使用缓存图片
if-Modified-Since:记录本地缓存的最后变更时间
if-None-Match:是否允许在资源未变动的情况下,返回304,如果变动返回200
# 响应头中请求的数据信息
Content-Length:请求数据的长度
Content-Type:请求数据的类型
X-Requested-With:XMLHttpRequest:是否是使用Ajax发送的请求


Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Cache-Control: no-cache
Connection: keep-alive
Cookie: BD_UPN=13314352; BIDUPSID=F7AE0FBE079AB973F3BA86282D8900CC; PSTM=1512724417; BAIDUID=A792FBB59016E98CD297DF2B26D2CDD4:FG=1; H_WISE_SIDS=164576_164370_164954_164845_161288_163320_163699_165736_156286_163808_159609_162898_165801_163453_165552_163973_151532_165328_159382_131862_164291_161244_160879_157262_163389_127969_165634_164164_164940_165237_160278_164659_131423_162732_132550_162003_164219_107315_163597_160574_161965_165071_163916_162153_144966_165373_165134_154213_158640_156848_162725_163115_164283_16177…TU1MmU2N2IwYWQwYzk4ZDM3MWFiYTNlNTQ4MzZlZWU3NWM1YTQ2MDFhMTExNWNmZDJmYzM0OGM0ZTZhNjc0ZWMxNjg0MTUyZGNmZmNmNzE0MTQzNDRiYWE2MWI0MzU1N2I1OTk3YTZhM2MwYTI2NTA0ZGUzZWZkODNkYTkyMTQxOTYyOTIzYzdjMjVjYzQzM2JhMTNhNzYzNGRmZmM0N2I1ODkwM2FkYzAyMjgzZThlY2EzNjI4; BDRCVFR[SHOOb3ODEBt]=mk3SLVN4HKm; delPer=0; BD_CK_SAM=1; PSINO=5; BA_HECTOR=21ak21al2g25208k961glb02i0q; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; H_PS_645EC=c3fbOJ3%2FM%2FCVk%2BuWvhxwoGPl55gPw9d34Lu%2BACvYMH8Dje6og3HrPY3yS3Vd8SiglR1o; sug=3; sugstore=0; ORIGIN=0; bdime=0
Host: www.baidu.com
Pragma: no-cache
Referer: https://www.baidu.com/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0
'''


'''响应头
Content-Length: 54
Content-Type: text/plain; charset=UTF-8
Date: Thu, 30 Sep 2021 09:17:26 GMT
'''

 

原创视频,版权所有,未经允许,切勿转载,违者必究!
回顶部