{"id":1135131,"date":"2025-01-08T21:21:55","date_gmt":"2025-01-08T13:21:55","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1135131.html"},"modified":"2025-01-08T21:21:57","modified_gmt":"2025-01-08T13:21:57","slug":"python%e5%a6%82%e4%bd%95%e5%81%9a%e4%b8%80%e6%ac%behttp%e6%8a%93%e5%8c%85","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1135131.html","title":{"rendered":"python\u5982\u4f55\u505a\u4e00\u6b3ehttp\u6293\u5305"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25103856\/ff6dae68-f17c-44fa-9d74-077d89b78785.webp\" alt=\"python\u5982\u4f55\u505a\u4e00\u6b3ehttp\u6293\u5305\" \/><\/p>\n<p><p> <strong>Python\u5982\u4f55\u505a\u4e00\u6b3eHTTP\u6293\u5305<\/strong><\/p>\n<\/p>\n<p><p><strong>Python\u505aHTTP\u6293\u5305\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u5982Scapy\u3001\u4f7f\u7528HTTP\u4ee3\u7406\u5e93\u5982Mitmproxy\u3001\u7ed3\u5408Socket\u7f16\u7a0b\u7b49\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Mitmproxy\u8fdb\u884cHTTP\u6293\u5305\u3002<\/strong><\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u7b80\u4ecb<\/h3>\n<\/p>\n<p><p>HTTP\u6293\u5305\u662f\u6307\u6355\u83b7\u5e76\u5206\u6790HTTP\u534f\u8bae\u7684\u6570\u636e\u5305\uff0c\u4ee5\u4fbf\u4e86\u89e3\u7f51\u7edc\u901a\u4fe1\u7684\u8be6\u7ec6\u60c5\u51b5\u3002Python\u4f5c\u4e3a\u4e00\u79cd\u5f3a\u5927\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u63d0\u4f9b\u4e86\u591a\u79cd\u5de5\u5177\u548c\u5e93\u6765\u5b9e\u73b0\u8fd9\u4e00\u529f\u80fd\u3002\u5176\u4e2d\uff0cMitmproxy\u662f\u4e00\u4e2a\u5f3a\u5927\u7684HTTP\/HTTPS\u4ee3\u7406\u5de5\u5177\uff0c\u5e38\u7528\u4e8e\u6293\u5305\u5206\u6790\u3002\u5b83\u5177\u6709\u4e30\u5bcc\u7684\u529f\u80fd\u548c\u53cb\u597d\u7684\u7528\u6237\u754c\u9762\uff0c\u975e\u5e38\u9002\u5408\u7f51\u7edc\u8c03\u8bd5\u3001\u6570\u636e\u5206\u6790\u548c\u5b89\u5168\u7814\u7a76\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u57fa\u7840\u6982\u5ff5<\/h3>\n<\/p>\n<p><h4>1\u3001\u4ec0\u4e48\u662fHTTP\u6293\u5305\uff1f<\/h4>\n<\/p>\n<p><p>HTTP\u6293\u5305\u662f\u6307\u5728\u7f51\u7edc\u901a\u4fe1\u8fc7\u7a0b\u4e2d\u62e6\u622a\u548c\u67e5\u770bHTTP\u8bf7\u6c42\u548c\u54cd\u5e94\u6570\u636e\u5305\u7684\u8fc7\u7a0b\u3002\u901a\u8fc7\u6293\u5305\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u4e86\u89e3\u6570\u636e\u4f20\u8f93\u7684\u8be6\u7ec6\u60c5\u51b5\uff0c\u627e\u5230\u6f5c\u5728\u7684\u95ee\u9898\uff0c\u5e76\u8fdb\u884c\u76f8\u5e94\u7684\u8c03\u8bd5\u548c\u4f18\u5316\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u4e3a\u4ec0\u4e48\u9009\u62e9Python\uff1f<\/h4>\n<\/p>\n<p><p>Python\u662f\u4e00\u79cd\u7b80\u6d01\u9ad8\u6548\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u5177\u6709\u5e7f\u6cdb\u7684\u7b2c\u4e09\u65b9\u5e93\u652f\u6301\u3002\u4f7f\u7528Python\u8fdb\u884cHTTP\u6293\u5305\uff0c\u65e2\u53ef\u4ee5\u5feb\u901f\u5b9e\u73b0\u529f\u80fd\uff0c\u53c8\u53ef\u4ee5\u901a\u8fc7\u4e30\u5bcc\u7684\u5e93\u548c\u5de5\u5177\u8fdb\u884c\u6269\u5c55\u548c\u4f18\u5316\u3002<\/p>\n<\/p>\n<p><h4>3\u3001Mitmproxy\u7b80\u4ecb<\/h4>\n<\/p>\n<p><p>Mitmproxy\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u4ea4\u4e92\u5f0fHTTP\/HTTPS\u4ee3\u7406\u5de5\u5177\uff0c\u652f\u6301HTTP\/2\u534f\u8bae\u3002\u5b83\u53ef\u4ee5\u62e6\u622a\u3001\u4fee\u6539\u548c\u8f6c\u53d1HTTP\u6d41\u91cf\uff0c\u63d0\u4f9b\u8be6\u7ec6\u7684\u8bf7\u6c42\u548c\u54cd\u5e94\u4fe1\u606f\uff0c\u652f\u6301\u811a\u672c\u5316\u64cd\u4f5c\uff0c\u975e\u5e38\u9002\u5408\u8fdb\u884cHTTP\u6293\u5305\u5206\u6790\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u73af\u5883\u51c6\u5907<\/h3>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5Python\u73af\u5883\u548cMitmproxy\u5de5\u5177\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5Python<\/h4>\n<\/p>\n<p><p>\u786e\u4fdd\u7cfb\u7edf\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u73af\u5883\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u6ca1\u6709\u5b89\u88c5Python\uff0c\u53ef\u4ee5\u4ece<a href=\"https:\/\/www.python.org\/\">Python\u5b98\u65b9\u7f51\u7ad9<\/a>\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u5b89\u88c5Mitmproxy<\/h4>\n<\/p>\n<p><p>Mitmproxy\u53ef\u4ee5\u901a\u8fc7pip\u8fdb\u884c\u5b89\u88c5\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install mitmproxy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Mitmproxy\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">mitmproxy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528Mitmproxy\u8fdb\u884cHTTP\u6293\u5305<\/h3>\n<\/p>\n<p><h4>1\u3001\u542f\u52a8Mitmproxy<\/h4>\n<\/p>\n<p><p>\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Mitmproxy\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">mitmproxy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cMitmproxy\u4f1a\u76d1\u542c\u672c\u5730\u76848080\u7aef\u53e3\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u4fee\u6539\u76d1\u542c\u7aef\u53e3\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">mitmproxy -p 8888<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u914d\u7f6e\u4ee3\u7406<\/h4>\n<\/p>\n<p><p>\u5728\u9700\u8981\u6293\u5305\u7684\u8bbe\u5907\u4e0a\uff0c\u5c06\u7f51\u7edc\u4ee3\u7406\u8bbe\u7f6e\u4e3aMitmproxy\u7684\u76d1\u542c\u5730\u5740\u548c\u7aef\u53e3\u3002\u4f8b\u5982\uff0c\u5982\u679cMitmproxy\u5728\u672c\u5730\u8fd0\u884c\u4e14\u76d1\u542c\u7aef\u53e3\u4e3a8080\uff0c\u5219\u4ee3\u7406\u5730\u5740\u5e94\u8bbe\u7f6e\u4e3a<code>127.0.0.1:8080<\/code>\u3002<\/p>\n<\/p>\n<p><h4>3\u3001\u6355\u83b7HTTP\u6d41\u91cf<\/h4>\n<\/p>\n<p><p>\u914d\u7f6e\u4ee3\u7406\u540e\uff0c\u6240\u6709\u901a\u8fc7\u8be5\u4ee3\u7406\u7684HTTP\u8bf7\u6c42\u548c\u54cd\u5e94\u90fd\u4f1a\u88abMitmproxy\u6355\u83b7\u5e76\u663e\u793a\u5728\u754c\u9762\u4e2d\u3002\u53ef\u4ee5\u4f7f\u7528\u6d4f\u89c8\u5668\u6216\u5176\u4ed6HTTP\u5ba2\u6237\u7aef\u8fdb\u884c\u6d4b\u8bd5\uff0c\u8bbf\u95ee\u4efb\u610f\u7f51\u9875\uff0cMitmproxy\u4f1a\u6355\u83b7\u5e76\u663e\u793a\u76f8\u5173\u8bf7\u6c42\u548c\u54cd\u5e94\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h4>4\u3001\u67e5\u770b\u548c\u5206\u6790\u6570\u636e\u5305<\/h4>\n<\/p>\n<p><p>Mitmproxy\u63d0\u4f9b\u4e86\u8be6\u7ec6\u7684\u8bf7\u6c42\u548c\u54cd\u5e94\u4fe1\u606f\uff0c\u5305\u62ec\u8bf7\u6c42\u65b9\u6cd5\u3001URL\u3001\u5934\u90e8\u4fe1\u606f\u3001\u54cd\u5e94\u72b6\u6001\u7801\u3001\u54cd\u5e94\u4f53\u7b49\u3002\u53ef\u4ee5\u901a\u8fc7\u952e\u76d8\u5feb\u6377\u952e\u8fdb\u884c\u5bfc\u822a\u548c\u67e5\u770b\uff0c\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u5b9a\u4f4d\u548c\u5206\u6790\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u811a\u672c\u5316\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>Mitmproxy\u652f\u6301\u4f7f\u7528Python\u811a\u672c\u8fdb\u884c\u6269\u5c55\u548c\u81ea\u5b9a\u4e49\u64cd\u4f5c\u3002\u901a\u8fc7\u7f16\u5199\u811a\u672c\uff0c\u53ef\u4ee5\u5b9e\u73b0\u81ea\u52a8\u5316\u6293\u5305\u3001\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u7b49\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u7f16\u5199\u811a\u672c<\/h4>\n<\/p>\n<p><p>Mitmproxy\u811a\u672c\u662f\u4e00\u4e2aPython\u6587\u4ef6\uff0c\u901a\u5e38\u5305\u542b\u4ee5\u4e0b\u51e0\u4e2a\u90e8\u5206\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5bfc\u5165\u5fc5\u8981\u7684\u6a21\u5757\u548c\u5e93<\/li>\n<li>\u5b9a\u4e49\u4e8b\u4ef6\u5904\u7406\u51fd\u6570<\/li>\n<li>\u6ce8\u518c\u4e8b\u4ef6\u5904\u7406\u51fd\u6570<\/li>\n<\/ul>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684Mitmproxy\u811a\u672c\u793a\u4f8b\uff0c\u7528\u4e8e\u6253\u5370\u6240\u6709HTTP\u8bf7\u6c42\u7684URL\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from mitmproxy import http<\/p>\n<p>def request(flow: http.HTTPFlow) -&gt; None:<\/p>\n<p>    print(flow.request.url)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u52a0\u8f7d\u811a\u672c<\/h4>\n<\/p>\n<p><p>\u542f\u52a8Mitmproxy\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7<code>-s<\/code>\u53c2\u6570\u52a0\u8f7d\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">mitmproxy -s script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Mitmproxy\u4f1a\u5728\u6bcf\u6b21\u6355\u83b7HTTP\u8bf7\u6c42\u65f6\u8c03\u7528\u811a\u672c\u4e2d\u7684<code>request<\/code>\u51fd\u6570\uff0c\u6253\u5370\u8bf7\u6c42\u7684URL\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u793a\u4f8b\u9879\u76ee<\/h3>\n<\/p>\n<p><p>\u4e3a\u66f4\u597d\u5730\u7406\u89e3\u5982\u4f55\u4f7f\u7528Python\u548cMitmproxy\u8fdb\u884cHTTP\u6293\u5305\uff0c\u6211\u4eec\u5c06\u521b\u5efa\u4e00\u4e2a\u793a\u4f8b\u9879\u76ee\uff0c\u6293\u53d6\u6307\u5b9a\u7f51\u7ad9\u7684\u6240\u6709HTTP\u8bf7\u6c42\uff0c\u5e76\u5c06\u8bf7\u6c42\u4fe1\u606f\u4fdd\u5b58\u5230\u6587\u4ef6\u4e2d\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u9879\u76ee\u7ed3\u6784<\/h4>\n<\/p>\n<p><p>\u9879\u76ee\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code>http_sniffer\/<\/p>\n<p>    \u251c\u2500\u2500 m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n.py<\/p>\n<p>    \u2514\u2500\u2500 sniffer.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u7f16\u5199Sniffer\u811a\u672c<\/h4>\n<\/p>\n<p><p>\u5728<code>sniffer.py<\/code>\u6587\u4ef6\u4e2d\uff0c\u7f16\u5199\u6293\u5305\u811a\u672c\uff0c\u6355\u83b7HTTP\u8bf7\u6c42\u5e76\u4fdd\u5b58\u5230\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from mitmproxy import http<\/p>\n<p>import json<\/p>\n<p>class Sniffer:<\/p>\n<p>    def __init__(self, output_file):<\/p>\n<p>        self.output_file = output_file<\/p>\n<p>        self.requests = []<\/p>\n<p>    def request(self, flow: http.HTTPFlow) -&gt; None:<\/p>\n<p>        request_info = {<\/p>\n<p>            &quot;method&quot;: flow.request.method,<\/p>\n<p>            &quot;url&quot;: flow.request.url,<\/p>\n<p>            &quot;headers&quot;: dict(flow.request.headers),<\/p>\n<p>            &quot;content&quot;: flow.request.content.decode(&#39;utf-8&#39;, errors=&#39;ignore&#39;)<\/p>\n<p>        }<\/p>\n<p>        self.requests.append(request_info)<\/p>\n<p>    def done(self):<\/p>\n<p>        with open(self.output_file, &#39;w&#39;) as f:<\/p>\n<p>            json.dump(self.requests, f, indent=4)<\/p>\n<p>addons = [<\/p>\n<p>    Sniffer(&quot;requests.json&quot;)<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u7f16\u5199\u4e3b\u7a0b\u5e8f<\/h4>\n<\/p>\n<p><p>\u5728<code>main.py<\/code>\u6587\u4ef6\u4e2d\uff0c\u542f\u52a8Mitmproxy\u5e76\u52a0\u8f7dSniffer\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    os.system(&quot;mitmproxy -s sniffer.py&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4\u3001\u8fd0\u884c\u9879\u76ee<\/h4>\n<\/p>\n<p><p>\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884c\u9879\u76ee\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python main.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u914d\u7f6e\u4ee3\u7406\u540e\uff0c\u8bbf\u95ee\u4efb\u610f\u7f51\u7ad9\uff0c\u6240\u6709HTTP\u8bf7\u6c42\u4fe1\u606f\u5c06\u88ab\u6355\u83b7\u5e76\u4fdd\u5b58\u5230<code>requests.json<\/code>\u6587\u4ef6\u4e2d\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528Python\u548cMitmproxy\u8fdb\u884cHTTP\u6293\u5305\u3002\u901a\u8fc7\u5b89\u88c5\u548c\u914d\u7f6eMitmproxy\uff0c\u6355\u83b7\u5e76\u5206\u6790HTTP\u6d41\u91cf\uff0c\u7f16\u5199\u811a\u672c\u8fdb\u884c\u81ea\u52a8\u5316\u64cd\u4f5c\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0HTTP\u6293\u5305\u548c\u6570\u636e\u5206\u6790\u3002Mitmproxy\u4f5c\u4e3a\u4e00\u4e2a\u5f3a\u5927\u7684HTTP\/HTTPS\u4ee3\u7406\u5de5\u5177\uff0c\u5177\u6709\u4e30\u5bcc\u7684\u529f\u80fd\u548c\u7075\u6d3b\u7684\u6269\u5c55\u6027\uff0c\u975e\u5e38\u9002\u5408\u7f51\u7edc\u8c03\u8bd5\u3001\u6570\u636e\u5206\u6790\u548c\u5b89\u5168\u7814\u7a76\u3002\u901a\u8fc7\u4e0d\u65ad\u5b9e\u8df5\u548c\u63a2\u7d22\uff0c\u76f8\u4fe1\u8bfb\u8005\u53ef\u4ee5\u638c\u63e1\u66f4\u591a\u9ad8\u7ea7\u6280\u5de7\uff0c\u63d0\u5347\u6293\u5305\u5206\u6790\u7684\u6548\u7387\u548c\u6548\u679c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u8fdb\u884cHTTP\u6293\u5305\uff1f<\/strong><br \/>\u4f7f\u7528Python\u8fdb\u884cHTTP\u6293\u5305\u901a\u5e38\u9700\u8981\u5229\u7528\u4e00\u4e9b\u5f3a\u5927\u7684\u5e93\uff0c\u6bd4\u5982<code>requests<\/code>\u548c<code>scapy<\/code>\u3002<code>requests<\/code>\u5e93\u53ef\u4ee5\u5e2e\u52a9\u4f60\u53d1\u9001HTTP\u8bf7\u6c42\uff0c\u800c<code>scapy<\/code>\u5219\u80fd\u591f\u6355\u6349\u7f51\u7edc\u6570\u636e\u5305\u3002\u7ed3\u5408\u8fd9\u4e24\u4e2a\u5e93\uff0c\u4f60\u53ef\u4ee5\u5b9e\u73b0\u6293\u53d6HTTP\u6d41\u91cf\u7684\u529f\u80fd\u3002<\/p>\n<p><strong>\u662f\u5426\u9700\u8981\u7279\u5b9a\u7684\u5e93\u6216\u5de5\u5177\u6765\u6293\u5305\uff1f<\/strong><br \/>\u662f\u7684\uff0cPython\u4e2d\u6709\u51e0\u4e2a\u975e\u5e38\u5b9e\u7528\u7684\u5e93\u53ef\u4ee5\u7528\u6765\u6293\u5305\u3002\u5176\u4e2d\uff0c<code>mitmproxy<\/code>\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u4f5c\u4e3aHTTP\u4ee3\u7406\uff0c\u5141\u8bb8\u4f60\u6355\u83b7\u3001\u4fee\u6539\u548c\u91cd\u653eHTTP\u8bf7\u6c42\u548c\u54cd\u5e94\u3002\u6b64\u5916\uff0c<code>Pyshark<\/code>\u5e93\u4e5f\u53ef\u4ee5\u7528\u6765\u8bfb\u53d6\u548c\u5206\u6790\u7f51\u7edc\u6570\u636e\u5305\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u6293\u53d6\u5230\u7684\u6570\u636e\uff1f<\/strong><br \/>\u6293\u53d6\u5230\u7684\u6570\u636e\u901a\u5e38\u662f\u4ee5JSON\u3001XML\u6216\u6587\u672c\u683c\u5f0f\u5448\u73b0\u7684\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528Python\u7684\u5185\u7f6e\u5e93\u5982<code>json<\/code>\u6216<code>xml.etree.ElementTree<\/code>\u6765\u89e3\u6790\u8fd9\u4e9b\u6570\u636e\u3002\u89e3\u6790\u540e\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u8981\u5c06\u6570\u636e\u5b58\u50a8\u5230\u6570\u636e\u5e93\u3001\u6587\u4ef6\u6216\u76f4\u63a5\u8fdb\u884c\u5206\u6790\u3002<\/p>\n<p><strong>\u6293\u5305\u8fc7\u7a0b\u4e2d\u5982\u4f55\u907f\u514d\u5f71\u54cd\u7f51\u7edc\u6027\u80fd\uff1f<\/strong><br \/>\u6293\u5305\u4f1a\u589e\u52a0\u7f51\u7edc\u5ef6\u8fdf\uff0c\u56e0\u6b64\u5728\u8fdb\u884cHTTP\u6293\u5305\u65f6\uff0c\u5efa\u8bae\u5728\u975e\u9ad8\u5cf0\u65f6\u6bb5\u8fdb\u884c\u6d4b\u8bd5\uff0c\u5e76\u786e\u4fdd\u6293\u5305\u5de5\u5177\u914d\u7f6e\u5f97\u5f53\u3002\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u5408\u9002\u7684\u8fc7\u6ee4\u5668\u6765\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u6570\u636e\u6d41\u91cf\uff0c\u4ece\u800c\u964d\u4f4e\u5bf9\u7f51\u7edc\u6027\u80fd\u7684\u5f71\u54cd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5982\u4f55\u505a\u4e00\u6b3eHTTP\u6293\u5305 Python\u505aHTTP\u6293\u5305\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u5982Scapy\u3001\u4f7f\u7528HTT [&hellip;]","protected":false},"author":3,"featured_media":1135136,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1135131"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1135131"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1135131\/revisions"}],"predecessor-version":[{"id":1135137,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1135131\/revisions\/1135137"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1135136"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1135131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1135131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1135131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}