{"id":1116532,"date":"2025-01-08T18:17:22","date_gmt":"2025-01-08T10:17:22","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1116532.html"},"modified":"2025-01-08T18:17:24","modified_gmt":"2025-01-08T10:17:24","slug":"python%e9%87%8c%e5%a6%82%e4%bd%95%e8%af%bb%e5%8f%96%e4%b8%80%e4%b8%aaip%e5%9c%b0%e5%9d%80","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1116532.html","title":{"rendered":"python\u91cc\u5982\u4f55\u8bfb\u53d6\u4e00\u4e2aip\u5730\u5740"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25080832\/8cc73494-2d0c-40ce-86bb-7b5b3d028ef7.webp\" alt=\"python\u91cc\u5982\u4f55\u8bfb\u53d6\u4e00\u4e2aip\u5730\u5740\" \/><\/p>\n<p><p> <strong>\u5728Python\u91cc\u8bfb\u53d6\u4e00\u4e2aIP\u5730\u5740\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528socket\u5e93\u3001ipaddress\u5e93\u3001\u5916\u90e8IP\u83b7\u53d6\u670d\u52a1\u7b49\u3002<\/strong>\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u901a\u8fc7socket\u5e93\u83b7\u53d6\u672c\u5730IP\u5730\u5740\u548c\u901a\u8fc7\u5916\u90e8\u670d\u52a1\u83b7\u53d6\u516c\u7f51IP\u5730\u5740\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u8ba8\u8bba\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\u7684\u4e00\u79cd\u5e76\u7ed9\u51fa\u5177\u4f53\u5b9e\u73b0\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528socket\u5e93\u8bfb\u53d6\u672c\u5730IP\u5730\u5740<\/h3>\n<\/p>\n<p><p>Python\u7684socket\u5e93\u63d0\u4f9b\u4e86\u5904\u7406\u7f51\u7edc\u8fde\u63a5\u548c\u6570\u636e\u4f20\u8f93\u7684\u57fa\u672c\u529f\u80fd\u3002\u901a\u8fc7socket\u5e93\uff0c\u53ef\u4ee5\u8f7b\u677e\u83b7\u53d6\u672c\u5730\u7684IP\u5730\u5740\u3002socket\u5e93\u662fPython\u6807\u51c6\u5e93\u7684\u4e00\u90e8\u5206\uff0c\u56e0\u6b64\u4e0d\u9700\u8981\u989d\u5916\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h4>\u83b7\u53d6\u672c\u5730IP\u5730\u5740\u7684\u6b65\u9aa4<\/h4>\n<\/p>\n<ol>\n<li><strong>\u5bfc\u5165socket\u5e93<\/strong>\uff1a\u9996\u5148\uff0c\u9700\u8981\u5bfc\u5165socket\u5e93\u3002<\/li>\n<li><strong>\u521b\u5efa\u4e00\u4e2asocket\u5bf9\u8c61<\/strong>\uff1a\u901a\u8fc7socket\u5e93\u521b\u5efa\u4e00\u4e2asocket\u5bf9\u8c61\u3002<\/li>\n<li><strong>\u83b7\u53d6\u4e3b\u673a\u540d<\/strong>\uff1a\u4f7f\u7528<code>socket.gethostname()<\/code>\u51fd\u6570\u83b7\u53d6\u4e3b\u673a\u540d\u3002<\/li>\n<li><strong>\u83b7\u53d6IP\u5730\u5740<\/strong>\uff1a\u901a\u8fc7<code>socket.gethostbyname()<\/code>\u51fd\u6570\u83b7\u53d6IP\u5730\u5740\u3002<\/li>\n<\/ol>\n<p><p>\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import socket<\/p>\n<p>def get_local_ip():<\/p>\n<p>    # \u521b\u5efa\u4e00\u4e2asocket\u5bf9\u8c61<\/p>\n<p>    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)<\/p>\n<p>    try:<\/p>\n<p>        # \u8fde\u63a5\u5230\u4e00\u4e2a\u5916\u90e8IP\u5730\u5740\uff08\u6b64\u5904\u4f7f\u7528Google\u7684\u516c\u5171DNS\u670d\u52a1\u56688.8.8.8\uff09<\/p>\n<p>        s.connect((&quot;8.8.8.8&quot;, 80))<\/p>\n<p>        # \u83b7\u53d6\u672c\u5730IP\u5730\u5740<\/p>\n<p>        ip = s.getsockname()[0]<\/p>\n<p>    except Exception as e:<\/p>\n<p>        print(f&quot;\u65e0\u6cd5\u83b7\u53d6\u672c\u5730IP\u5730\u5740: {e}&quot;)<\/p>\n<p>        ip = None<\/p>\n<p>    finally:<\/p>\n<p>        # \u5173\u95edsocket\u8fde\u63a5<\/p>\n<p>        s.close()<\/p>\n<p>    return ip<\/p>\n<h2><strong>\u8c03\u7528\u51fd\u6570\u5e76\u6253\u5370\u7ed3\u679c<\/strong><\/h2>\n<p>local_ip = get_local_ip()<\/p>\n<p>print(f&quot;\u672c\u5730IP\u5730\u5740: {local_ip}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2aUDP\u7c7b\u578b\u7684socket\u5bf9\u8c61\uff0c\u5e76\u5c1d\u8bd5\u8fde\u63a5\u5230Google\u7684\u516c\u5171DNS\u670d\u52a1\u5668\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u6211\u4eec\u80fd\u591f\u83b7\u53d6\u5230\u672c\u5730IP\u5730\u5740\u3002\u6700\u540e\uff0c\u901a\u8fc7<code>sockname()<\/code>\u65b9\u6cd5\u83b7\u53d6\u5230\u672c\u5730IP\u5730\u5740\u5e76\u5173\u95ed\u8fde\u63a5\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528ipaddress\u5e93\u8fdb\u884cIP\u5730\u5740\u5904\u7406<\/h3>\n<\/p>\n<p><p>ipaddress\u5e93\u662fPython 3.3\u4e2d\u5f15\u5165\u7684\u4e00\u4e2a\u6807\u51c6\u5e93\uff0c\u4e13\u95e8\u7528\u4e8e\u5904\u7406\u548c\u64cd\u4f5cIP\u5730\u5740\u3002\u867d\u7136ipaddress\u5e93\u4e0d\u80fd\u76f4\u63a5\u83b7\u53d6IP\u5730\u5740\uff0c\u4f46\u5b83\u53ef\u4ee5\u7528\u6765\u89e3\u6790\u548c\u9a8c\u8bc1IP\u5730\u5740\u3002<\/p>\n<\/p>\n<p><h4>\u89e3\u6790\u548c\u9a8c\u8bc1IP\u5730\u5740<\/h4>\n<\/p>\n<ol>\n<li><strong>\u5bfc\u5165ipaddress\u5e93<\/strong>\uff1a\u9996\u5148\u9700\u8981\u5bfc\u5165ipaddress\u5e93\u3002<\/li>\n<li><strong>\u89e3\u6790IP\u5730\u5740<\/strong>\uff1a\u4f7f\u7528<code>ipaddress.ip_address()<\/code>\u51fd\u6570\u89e3\u6790\u4e00\u4e2aIP\u5730\u5740\u3002<\/li>\n<li><strong>\u9a8c\u8bc1IP\u5730\u5740<\/strong>\uff1a\u53ef\u4ee5\u901a\u8fc7\u5224\u65adIP\u5730\u5740\u5bf9\u8c61\u7684\u5c5e\u6027\u6765\u9a8c\u8bc1\u5730\u5740\u7c7b\u578b\uff08\u5982\u662f\u5426\u4e3a\u79c1\u6709\u5730\u5740\u3001\u662f\u5426\u4e3a\u5168\u5c40\u5730\u5740\u7b49\uff09\u3002<\/li>\n<\/ol>\n<p><p>\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import ipaddress<\/p>\n<p>def validate_ip(ip_str):<\/p>\n<p>    try:<\/p>\n<p>        # \u89e3\u6790IP\u5730\u5740<\/p>\n<p>        ip = ipaddress.ip_address(ip_str)<\/p>\n<p>        print(f&quot;IP\u5730\u5740 {ip} \u662f\u6709\u6548\u7684&quot;)<\/p>\n<p>        # \u68c0\u67e5IP\u5730\u5740\u662f\u5426\u4e3a\u79c1\u6709\u5730\u5740<\/p>\n<p>        if ip.is_private:<\/p>\n<p>            print(f&quot;IP\u5730\u5740 {ip} \u662f\u79c1\u6709\u5730\u5740&quot;)<\/p>\n<p>        # \u68c0\u67e5IP\u5730\u5740\u662f\u5426\u4e3a\u5168\u5c40\u5730\u5740<\/p>\n<p>        if ip.is_global:<\/p>\n<p>            print(f&quot;IP\u5730\u5740 {ip} \u662f\u5168\u5c40\u5730\u5740&quot;)<\/p>\n<p>    except ValueError:<\/p>\n<p>        print(f&quot;IP\u5730\u5740 {ip_str} \u662f\u65e0\u6548\u7684&quot;)<\/p>\n<h2><strong>\u793a\u4f8bIP\u5730\u5740<\/strong><\/h2>\n<p>ip_to_check = &quot;192.168.1.1&quot;<\/p>\n<p>validate_ip(ip_to_check)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>ipaddress.ip_address()<\/code>\u51fd\u6570\u6765\u89e3\u6790\u8f93\u5165\u7684IP\u5730\u5740\uff0c\u5e76\u901a\u8fc7\u5224\u65ad\u5c5e\u6027\u6765\u9a8c\u8bc1IP\u5730\u5740\u7684\u7c7b\u578b\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u901a\u8fc7\u5916\u90e8\u670d\u52a1\u83b7\u53d6\u516c\u7f51IP\u5730\u5740<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u6211\u4eec\u9700\u8981\u83b7\u53d6\u673a\u5668\u7684\u516c\u7f51IP\u5730\u5740\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee\u5916\u90e8\u670d\u52a1\u6765\u5b9e\u73b0\uff0c\u4f8b\u5982\u4f7f\u7528<code>requests<\/code>\u5e93\u8bbf\u95ee\u4e00\u4e2a\u8fd4\u56deIP\u5730\u5740\u7684API\u670d\u52a1\u3002<\/p>\n<\/p>\n<p><h4>\u4f7f\u7528requests\u5e93\u83b7\u53d6\u516c\u7f51IP\u5730\u5740<\/h4>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5requests\u5e93<\/strong>\uff1a\u5982\u679c\u672a\u5b89\u88c5requests\u5e93\uff0c\u53ef\u4ee5\u901a\u8fc7pip\u8fdb\u884c\u5b89\u88c5\u3002<\/li>\n<li><strong>\u5bfc\u5165requests\u5e93<\/strong>\uff1a\u5bfc\u5165requests\u5e93\u3002<\/li>\n<li><strong>\u53d1\u9001\u8bf7\u6c42\u5230\u5916\u90e8\u670d\u52a1<\/strong>\uff1a\u4f7f\u7528<code>requests.get()<\/code>\u51fd\u6570\u53d1\u9001HTTP\u8bf7\u6c42\u5230\u5916\u90e8\u670d\u52a1\u3002<\/li>\n<li><strong>\u89e3\u6790\u8fd4\u56de\u7ed3\u679c<\/strong>\uff1a\u4eceHTTP\u54cd\u5e94\u4e2d\u89e3\u6790IP\u5730\u5740\u3002<\/li>\n<\/ol>\n<p><p>\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import requests<\/p>\n<p>def get_public_ip():<\/p>\n<p>    try:<\/p>\n<p>        # \u53d1\u9001\u8bf7\u6c42\u5230\u5916\u90e8\u670d\u52a1<\/p>\n<p>        response = requests.get(&quot;https:\/\/api.ipify.org?format=json&quot;)<\/p>\n<p>        # \u89e3\u6790\u8fd4\u56de\u7ed3\u679c<\/p>\n<p>        ip = response.json()[&quot;ip&quot;]<\/p>\n<p>    except requests.RequestException as e:<\/p>\n<p>        print(f&quot;\u65e0\u6cd5\u83b7\u53d6\u516c\u7f51IP\u5730\u5740: {e}&quot;)<\/p>\n<p>        ip = None<\/p>\n<p>    return ip<\/p>\n<h2><strong>\u8c03\u7528\u51fd\u6570\u5e76\u6253\u5370\u7ed3\u679c<\/strong><\/h2>\n<p>public_ip = get_public_ip()<\/p>\n<p>print(f&quot;\u516c\u7f51IP\u5730\u5740: {public_ip}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>requests.get()<\/code>\u51fd\u6570\u5411<code>api.ipify.org<\/code>\u53d1\u9001HTTP\u8bf7\u6c42\uff0c\u5e76\u4ece\u8fd4\u56de\u7684JSON\u54cd\u5e94\u4e2d\u63d0\u53d6IP\u5730\u5740\u3002\u8fd9\u79cd\u65b9\u6cd5\u975e\u5e38\u65b9\u4fbf\uff0c\u9002\u7528\u4e8e\u9700\u8981\u83b7\u53d6\u516c\u7f51IP\u5730\u5740\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u7efc\u5408\u4f7f\u7528socket\u5e93\u548c\u5916\u90e8\u670d\u52a1<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u80fd\u9700\u8981\u540c\u65f6\u83b7\u53d6\u672c\u5730IP\u5730\u5740\u548c\u516c\u7f51IP\u5730\u5740\u3002\u6211\u4eec\u53ef\u4ee5\u7efc\u5408\u4f7f\u7528socket\u5e93\u548crequests\u5e93\u5b9e\u73b0\u8fd9\u4e00\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7efc\u5408\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import socket<\/p>\n<p>import requests<\/p>\n<p>def get_ip_addresses():<\/p>\n<p>    # \u83b7\u53d6\u672c\u5730IP\u5730\u5740<\/p>\n<p>    local_ip = None<\/p>\n<p>    try:<\/p>\n<p>        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)<\/p>\n<p>        s.connect((&quot;8.8.8.8&quot;, 80))<\/p>\n<p>        local_ip = s.getsockname()[0]<\/p>\n<p>        s.close()<\/p>\n<p>    except Exception as e:<\/p>\n<p>        print(f&quot;\u65e0\u6cd5\u83b7\u53d6\u672c\u5730IP\u5730\u5740: {e}&quot;)<\/p>\n<p>    # \u83b7\u53d6\u516c\u7f51IP\u5730\u5740<\/p>\n<p>    public_ip = None<\/p>\n<p>    try:<\/p>\n<p>        response = requests.get(&quot;https:\/\/api.ipify.org?format=json&quot;)<\/p>\n<p>        public_ip = response.json()[&quot;ip&quot;]<\/p>\n<p>    except requests.RequestException as e:<\/p>\n<p>        print(f&quot;\u65e0\u6cd5\u83b7\u53d6\u516c\u7f51IP\u5730\u5740: {e}&quot;)<\/p>\n<p>    return local_ip, public_ip<\/p>\n<h2><strong>\u8c03\u7528\u51fd\u6570\u5e76\u6253\u5370\u7ed3\u679c<\/strong><\/h2>\n<p>local_ip, public_ip = get_ip_addresses()<\/p>\n<p>print(f&quot;\u672c\u5730IP\u5730\u5740: {local_ip}&quot;)<\/p>\n<p>print(f&quot;\u516c\u7f51IP\u5730\u5740: {public_ip}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u540c\u65f6\u83b7\u53d6\u4e86\u672c\u5730IP\u5730\u5740\u548c\u516c\u7f51IP\u5730\u5740\uff0c\u5e76\u5c06\u7ed3\u679c\u6253\u5370\u51fa\u6765\u3002\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u6ee1\u8db3\u5927\u591a\u6570\u5e94\u7528\u573a\u666f\u7684\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h3>\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\u8bfb\u53d6IP\u5730\u5740\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u4e3b\u8981\u5305\u62ec\u4f7f\u7528socket\u5e93\u83b7\u53d6\u672c\u5730IP\u5730\u5740\u3001\u4f7f\u7528ipaddress\u5e93\u89e3\u6790\u548c\u9a8c\u8bc1IP\u5730\u5740\u3001\u901a\u8fc7\u5916\u90e8\u670d\u52a1\u83b7\u53d6\u516c\u7f51IP\u5730\u5740\u7b49\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u6216\u8005\u7efc\u5408\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002\u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u5728Python\u7a0b\u5e8f\u4e2d\u8bfb\u53d6\u548c\u5904\u7406IP\u5730\u5740\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u83b7\u53d6\u7528\u6237\u7684\u672c\u5730IP\u5730\u5740\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>socket<\/code>\u6a21\u5757\u6765\u83b7\u53d6\u672c\u5730IP\u5730\u5740\u3002\u901a\u8fc7\u8c03\u7528<code>socket.gethostbyname(socket.gethostname())<\/code>\uff0c\u53ef\u4ee5\u8f7b\u677e\u83b7\u53d6\u672c\u673a\u7684IP\u5730\u5740\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u5927\u591a\u6570\u64cd\u4f5c\u7cfb\u7edf\u3002<\/p>\n<p><strong>Python\u4e2d\u6709\u6ca1\u6709\u5e93\u53ef\u4ee5\u65b9\u4fbf\u5730\u8bfb\u53d6\u8fdc\u7a0bIP\u5730\u5740\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u4f7f\u7528<code>requests<\/code>\u5e93\u53ef\u4ee5\u8f7b\u677e\u8bfb\u53d6\u8fdc\u7a0bIP\u5730\u5740\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u53d1\u9001\u8bf7\u6c42\u5230\u4e00\u4e2a\u63d0\u4f9bIP\u4fe1\u606f\u7684API\uff0c\u5982<code>http:\/\/api.ipify.org<\/code>\u3002\u793a\u4f8b\u4ee3\u7801\u4e3a\uff1a<\/p>\n<pre><code class=\"language-python\">import requests\nresponse = requests.get(&quot;http:\/\/api.ipify.org&quot;)\nprint(&quot;Your IP address is:&quot;, response.text)\n<\/code><\/pre>\n<p>\u8fd9\u6837\u53ef\u4ee5\u5feb\u901f\u83b7\u53d6\u5f53\u524d\u8bbe\u5907\u7684\u516c\u5171IP\u5730\u5740\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u89e3\u6790IP\u5730\u5740\u7684\u8be6\u7ec6\u4fe1\u606f\uff1f<\/strong><br \/>\u4f7f\u7528<code>ipinfo<\/code>\u5e93\u53ef\u4ee5\u83b7\u53d6IP\u5730\u5740\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u5730\u7406\u4f4d\u7f6e\u3001ISP\u7b49\u3002\u9996\u5148\u9700\u8981\u5b89\u88c5\u8be5\u5e93\uff0c\u7136\u540e\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165IP\u5730\u5740\u6765\u83b7\u53d6\u76f8\u5173\u4fe1\u606f\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code class=\"language-python\">import ipinfo\naccess_token = &#39;YOUR_ACCESS_TOKEN&#39;\nhandler = ipinfo.getHandler(access_token)\ndet<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ls = handler.getDetails(&#39;8.8.8.8&#39;)\nprint(details.all)\n<\/code><\/pre>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u53ef\u4ee5\u5e2e\u52a9\u4f60\u83b7\u53d6\u6307\u5b9aIP\u5730\u5740\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u91cc\u8bfb\u53d6\u4e00\u4e2aIP\u5730\u5740\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528socket\u5e93\u3001ipaddress\u5e93\u3001\u5916\u90e8IP\u83b7\u53d6\u670d\u52a1\u7b49 [&hellip;]","protected":false},"author":3,"featured_media":1116538,"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\/1116532"}],"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=1116532"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1116532\/revisions"}],"predecessor-version":[{"id":1116541,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1116532\/revisions\/1116541"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1116538"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1116532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1116532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1116532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}