Python网络编程——HTTP请求报文

简介: HTTP报文分为请求报文和响应报文。常见的请求报文有两种GET方式和POST 方式。

概述

HTTP报文分为请求报文和响应报文。

常见的请求报文有两种GET方式和POST 方式

区别

GET方式会把数据传在url后面,使用?分割,各个参数之间使用&分割

比如:

https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=%E4%BD%A0%E5%A5%BD&oq=http%25E6%258A%25A5%25E6%2596%2587&rsv_pq=81d8ee2c0000913c&rsv_t=0863vw45F2C66ac%2ByKbOZa%2BDhaEmWiqPbcVqcsE5hyO07Vila1Rjj7VAlz8&rqlang=cn&rsv_dl=tb&rsv_enter=1&rsv_sug3=10&rsv_sug1=12&rsv_sug7=101&rsv_sug2=0&rsv_btype=t&inputT=4163&rsv_sug4=5827


POST 方式会把提交的数据放在HTTP请求的<request-body>中。POST 方式的安全性比GET方式高。POST方式理论上对传输的数据量不受限,但GET方式由于URL长短的限制,传递的数据量有限制。


HTTP请求GET方式

http get请求报文的格式

请求行\r\n

请求头\r\n

空行(\r\n)

原始报文

----请求行-----GET/HTTP/1.1#请求方式和HTTP版本----请求头----Host: www.baidu.com#服务器的主机IP和端口号Connection: keep-alive#保持连接,如果三到五分钟没有数据交换则断开连接Cache-Control: max-age=0sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"sec-ch-ua-mobile: ?0sec-ch-ua-platform: "Windows"Upgrade-Insecure-Requests: 1User-Agent: Mozilla/5.0 (WindowsNT10.0; Win64; x64) AppleWebKit/537.36 (KHTML, likeGecko) Chrome/98.0.4758.102Safari/537.36#用户代理,客户端程序名称Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9#告诉服务端程序可以接受的数据类型Sec-Fetch-Site: noneSec-Fetch-Mode: navigateSec-Fetch-User: ?1Sec-Fetch-Dest: documentAccept-Encoding: gzip, deflate, br#告诉服务端程序支持的压缩算法Accept-Language: zh-TW,zh-CN;q=0.9,zh;q=0.8,en-US;q=0.7,en;q=0.6#告诉服务端程序支持的语言Cookie: BIDUPSID=988BA5BA88D86A76A08D155C84C243BF; PSTM=1625894550; __yjs_duid=1_f0df59cc17fe53e8037d1d9f70d0b5e61625901596275; BDUSS=9JZjlsd1ZBRVpJaS14UkJFa3p3SXlxVmNDfjBIUmJSOVNxVmJXSmVjZ0FmNHBoSVFBQUFBJCQAAAAAAAAAAAEAAAC7koZIamlhemhhbnVuNjE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyYmEA8mJhRW; BDUSS_BFESS=9JZjlsd1ZBRVpJaS14UkJFa3p3SXlxVmNDfjBIUmJSOVNxVmJXSmVjZ0FmNHBoSVFBQUFBJCQAAAAAAAAAAAEAAAC7koZIamlhemhhbnVuNjE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyYmEA8mJhRW; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; BAIDUID=9EFF6F706226F089FE47DE55F557C7F8:FG=1; H_WISE_SIDS=107312_110085_127969_174441_179345_184716_187392_188749_189034_189253_189755_190247_190617_191068_191247_191287_192206_192407_193284_194085_194511_194519_195189_195343_195631_196427_196514_196528_197242_197286_197471_197711_197782_197958_198069_198076_198270_198648_198930_199023_199082_199157_199305_199582_199753_200035_200275_200350_200734_200763_200958_201054_201233_201328_201360_201554_201580_201704_201733_201820_201948_201978_201985_201995_202112_202137_202393_202476_202554_202561_202563_202822_202894_202916_202922_203191_203236_203332_203494_203518_203544_203605_203629_203667_203688; BD_UPN=12314753; MCITY=-180%3A; BAIDUID_BFESS=9EFF6F706226F089FE47DE55F557C7F8:FG=1; channel=baidusearch; ariaDefaultTheme=undefined; RT="z=1&dm=baidu.com&si=4ubs83ndxp7&ss=l03dm4f6&sl=2&tt=2r6&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf&ld=4p4&ul=evup&hd=evz1"; BD_HOME=1; delPer=0; BD_CK_SAM=1; COOKIE_SESSION=78293_1_5_4_12_6_0_0_4_3_0_2_110163_0_18_0_1645966172_1645843866_1645966154%7C9%23157981_13_1645843863%7C9; PSINO=5; H_PS_PSSID=35836_34429_35105_31253_35909_34584_35872_35949_35802_35954_35319_26350_35883_35867_35879; baikeVisitId=9b108905-0cca-4e3b-8d83-4acff96e988a; H_PS_645EC=6172VDlcx2zzRQ%2FLyH4LFnNvOPn%2FS6MgAiS3ZExsKHIwMU771KaCF4byz4c; sugstore=1; BA_HECTOR=048g0l04018l0g0h5b1h1mu4j0q#客户端用户身份的标识  -----空行-----\r\n



HTTP请求POST方式

http post请求报文的格式

请求行\r\n

请求头\r\n

空行(\r\n)

请求体

原始报文

----请求行-----POST/v2/api/?loginHTTP/1.1#请求方式、请求路径和HTTP版本----请求头----Host: passport.baidu.comConnection: keep-aliveContent-Length: 4710Cache-Control: max-age=0sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"sec-ch-ua-mobile: ?0sec-ch-ua-platform: "Windows"Upgrade-Insecure-Requests: 1Origin: https://www.baidu.comContent-Type: application/x-www-form-urlencodedUser-Agent: Mozilla/5.0 (WindowsNT10.0; Win64; x64) AppleWebKit/537.36 (KHTML, likeGecko) Chrome/98.0.4758.102Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9Sec-Fetch-Site: same-siteSec-Fetch-Mode: navigateSec-Fetch-User: ?1Sec-Fetch-Dest: iframeReferer: https://www.baidu.com/Accept-Encoding: gzip, deflate, brAccept-Language: zh-TW,zh-CN;q=0.9,zh;q=0.8,en-US;q=0.7,en;q=0.6Cookie: BIDUPSID=988BA5BA88D86A76A08D155C84C243BF; PSTM=1625894550; __yjs_duid=1_f0df59cc17fe53e8037d1d9f70d0b5e61625901596275; HOSUPPORT=1; HOSUPPORT_BFESS=1; USERNAMETYPE=3; SAVEUSERID=eaf1e936bb278b3a0e60a785fbdd57; HISTORY=3f29f9a901da45e695db43ba10dfe1bcd71c5c; USERNAMETYPE_BFESS=3; SAVEUSERID_BFESS=eaf1e936bb278b3a0e60a785fbdd57; HISTORY_BFESS=3f29f9a901da45e695db43ba10dfe1bcd71c5c; STOKEN=05e80444d41cac6e71461f7269b1fcf371c5fcfc219ee0f288b4e77f4f30fee6; BDUSS=9JZjlsd1ZBRVpJaS14UkJFa3p3SXlxVmNDfjBIUmJSOVNxVmJXSmVjZ0FmNHBoSVFBQUFBJCQAAAAAAAAAAAEAAAC7koZIamlhemhhbnVuNjE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyYmEA8mJhRW; PTOKEN=67777fb99069b36811af09a93c187486; BDUSS_BFESS=9JZjlsd1ZBRVpJaS14UkJFa3p3SXlxVmNDfjBIUmJSOVNxVmJXSmVjZ0FmNHBoSVFBQUFBJCQAAAAAAAAAAAEAAAC7koZIamlhemhhbnVuNjE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyYmEA8mJhRW; STOKEN_BFESS=05e80444d41cac6e71461f7269b1fcf371c5fcfc219ee0f288b4e77f4f30fee6; PTOKEN_BFESS=67777fb99069b36811af09a93c187486; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; BAIDUID=9EFF6F706226F089FE47DE55F557C7F8:FG=1; H_WISE_SIDS=107312_110085_127969_174441_179345_184716_187392_188749_189034_189253_189755_190247_190617_191068_191247_191287_192206_192407_193284_194085_194511_194519_195189_195343_195631_196427_196514_196528_197242_197286_197471_197711_197782_197958_198069_198076_198270_198648_198930_199023_199082_199157_199305_199582_199753_200035_200275_200350_200734_200763_200958_201054_201233_201328_201360_201554_201580_201704_201733_201820_201948_201978_201985_201995_202112_202137_202393_202476_202554_202561_202563_202822_202894_202916_202922_203191_203236_203332_203494_203518_203544_203605_203629_203667_203688; MCITY=-180%3A; BAIDUID_BFESS=9EFF6F706226F089FE47DE55F557C7F8:FG=1; ariaDefaultTheme=undefined; RT="z=1&dm=baidu.com&si=4ubs83ndxp7&ss=l03dm4f6&sl=2&tt=2r6&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf&ld=4p4&ul=evup&hd=evz1"; delPer=0; H_PS_PSSID=35836_34429_35105_31253_35909_34584_35872_35949_35802_35954_35319_26350_35883_35867_35879; PSINO=7; UBI=fi_PncwhpxZ%7ETaL90a-47Rh3kgphPZzJMHIpBYhKS3ChLQRVkHLhKglwghTf3ZtjzwlLt-lK6fBNjn7yayFvv9LrN1XoRKRsW9qhHhxVZUzBIRp%7E1pYG411o35bxlbQXa6hEW4UrcH%7EmNFoMDiAgRyNSWTCEQ__; UBI_BFESS=fi_PncwhpxZ%7ETaL90a-47Rh3kgphPZzJMHIpBYhKS3ChLQRVkHLhKglwghTf3ZtjzwlLt-lK6fBNjn7yayFvv9LrN1XoRKRsW9qhHhxVZUzBIRp%7E1pYG411o35bxlbQXa6hEW4UrcH%7EmNFoMDiAgRyNSWTCEQ__; logTraceID=033db1542c82e03555feddc30d68d30e99e8a57696001b361c; BA_HECTOR=2h8ka40gaga18h00pf1h1mvce0q; pplogid=6035aQ%2Bv0kRFX0EksDZoovFrsHy7%2FBcEo8IIJo4XWuIG8kTKXm8aCz2nnLXJ8QV%2BgROL%2BU90i0M87Gt4TRa9cPBvqk%2Ftnaz8XdSHPMhdv7Rm4gw%3D; pplogid_BFESS=6035aQ%2Bv0kRFX0EksDZoovFrsHy7%2FBcEo8IIJo4XWuIG8kTKXm8aCz2nnLXJ8QV%2BgROL%2BU90i0M87Gt4TRa9cPBvqk%2Ftnaz8XdSHPMhdv7Rm4gw%3D-----空行-----\r\n-----请求体-----staticpage=https%3A%2F%2Fwww.baidu.com%2Fhome%2Fxman%2Fshow%2Fworldcupv3jump&charset=UTF-8&token=fecf6cf8bc86f45cafd10d61b99ee6b5&tpl=mn&subpro=&apiver=v3&tt=1645968901836&codestring=&safeflg=0&u=https%3A%2F%2Fwww.baidu.com%2F&isPhone=&detect=1&gid=B0BB4F7-8A32-4EDB-81C9-540020720137&quick_user=0&logintype=dialogLogin&logLoginType=pc_loginDialog&idc=&loginmerge=true&mkey=&splogin=rate&username=6ythgyhty&password=hUuOQqwYRc0dOgOiIqX%2BvkgOfIWIQq3V9lw32W2a0nj6Re8T5ylEmcO7b2bVHwo1fVuxRmZO%2BTxH0Nc%2FWO4hHQQher96sqhEJ2LCsxYpwguE4c7kig8kyelwbM4XdXKOlTQ1j9SEuQerSjMIMrsbj3PCpd0AcaACx%2Fyl7GIj9ok%3D&mem_pass=on&rsakey=0K2OyAKXUnAoM8jA3YN3lDDymO5MQexn&crypttype=12&ppui_logintime=8411&countrycode=&fp_uid=&fp_info=&loginversion=v4&supportdv=1&ds=NVLaXR5fy66vtR%2F%2Fg5qbruh1KtjvYInqghj8OPV2ogYwicBwwYSGz6L6srmINPTNQ5P4ABIX45MZka8BzkLX42v7sK87Iom2Vd%2FEaqg9Xd%2FJ%2BFL44VjqInw5bSqeUNx%2BJE3uAC%2FUmatPgu0pTCJp36Vl3TGnyxLY9JsimD%2FqlFpueLmoyYzCQkB6K0DbZB9rYYUxrpeqQQNLcApuEgsNSn4WKRFMioV03fLsOnMVcBp5UkxR%2FcMbQk7STur0mMQlnQkQnmZHimjCo9ROWrJUPMrYrWh9csoZbprUXQ42UirwuecXU%2F1GyLWHZ2pZztgC6UOKPDSPNCRyzCNPHUhpJj10eFLeVJymoTWpuHNBFDJlp0K9PQU5Ca0tR2BmN4iOdh0nu9ZT8GcGZvZFcQ1fGZrQyuOC6rXiGU5A4xSbeUR%2BfZ4t4yzW8FRMjzXGjiIJGCH9An4L6Tf57NRPlgL6vPqvAePU%2BgKA8FL0t2Kl5QW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tOFZicXZYM0JGaC9qVzlqdFZPcmtLOGxoZlJWaA%3D%3D&elapsed=3&shaOne=001b21cabd349a40f0aa8fa9da775074f9c2dd4a&rinfo=%7B%22fuid%22%3A%220ebee1744caad57d63e160d5ddfc3f6d%22%7D


目录
相关文章
|
5天前
|
数据采集 网络安全 Python
【Python】怎么解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
解决 `urllib.error.HTTPError: HTTP Error 403: Forbidden`错误需要根据具体情况进行不同的尝试。通过检查URL、模拟浏览器请求、使用代理服务器和Cookies、减慢请求速度、使用随机的User-Agent以及使用更加方便的 `requests`库,可以有效解决此类问题。通过逐步分析和调试,可以找到最合适的解决方案。
45 18
|
1天前
|
前端开发 网络协议 安全
【网络原理】——HTTP协议、fiddler抓包
HTTP超文本传输,HTML,fiddler抓包,URL,urlencode,HTTP首行方法,GET方法,POST方法
|
1天前
|
存储 JSON 缓存
【网络原理】——HTTP请求头中的属性
HTTP请求头,HOST、Content-Agent、Content-Type、User-Agent、Referer、Cookie。
|
3天前
|
JSON Dart 前端开发
鸿蒙应用开发从入门到入行 - 篇7:http网络请求
在本篇文章里,您将掌握鸿蒙开发工具DevEco的基本使用、ArkUI里的基础组件,并通过制作一个简单界面掌握使用
30 8
|
2天前
|
数据采集 安全 搜索推荐
HTTP代理IP纯净度 提升用户网络体验的核心竞争力
随着互联网发展,使用HTTP动态代理IP的需求日益增加。高纯净度的代理IP在隐私与安全、网络体验和业务运营方面至关重要。它能保护用户信息、提高数据安全性、确保访问速度和连接稳定,并提升业务效率与信誉度。
15 2
|
7天前
|
缓存 负载均衡 监控
HTTP代理服务器在网络安全中的重要性
随着科技和互联网的发展,HTTP代理IP中的代理服务器在企业业务中扮演重要角色。其主要作用包括:保护用户信息、访问控制、缓存内容、负载均衡、日志记录和协议转换,从而在网络管理、性能优化和安全性方面发挥关键作用。
27 2
|
19天前
|
数据采集 数据安全/隐私保护 Python
【Python】已解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
通过上述方法,可以有效解决 `urllib.error.HTTPError: HTTP Error 403: Forbidden` 错误。具体选择哪种方法取决于服务器对请求的限制。通常情况下,添加用户代理和模拟浏览器请求是最常见且有效的解决方案。
88 10
|
7天前
|
安全 网络协议 网络安全
网络不稳定导致HTTP代理频繁掉线的分析
随着数字化时代的加速发展,网络安全、隐私保护及内容访问自由成为用户核心需求。HTTP代理服务器因其独特技术优势受到青睐,但其掉线问题频发。本文分析了HTTP代理服务器不稳定导致掉线的主要原因,包括网络问题、服务器质量、用户配置错误及IP资源问题等方面。
34 0
|
Web App开发 前端开发 Apache
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head><meta http-equiv="Cont
修改的ranger ui的admin用户登录密码时,需要在ranger的配置里把admin_password改成一样的,否则hdfs的namenode在使用admin时启动不起来,异常如下: Traceback (mos...
1074 0
|
Web App开发
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head><meta http-equiv="Cont
TCP洪水攻击(SYN Flood)的诊断和处理 Posted by  海涛  on 2013 年 7 月 11 日 Tweet1 ​1. SYN Flood介绍 前段时间网站被攻击多次,其中最猛烈的就是TCP洪水攻击,即SYN Flood。
1011 0