{"id":929619,"date":"2024-12-26T16:59:16","date_gmt":"2024-12-26T08:59:16","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/929619.html"},"modified":"2024-12-26T16:59:19","modified_gmt":"2024-12-26T08:59:19","slug":"python-%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0tcp","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/929619.html","title":{"rendered":"Python \u5982\u4f55\u5b9e\u73b0tcp"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25064723\/ef8ac468-97f7-4899-9584-db6f53860d0d.webp\" alt=\"Python \u5982\u4f55\u5b9e\u73b0tcp\" \/><\/p>\n<p><p> <strong>Python \u5b9e\u73b0 TCP \u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528 socket \u6a21\u5757\u521b\u5efa TCP \u5957\u63a5\u5b57\u3001\u5229\u7528 socketserver \u6a21\u5757\u7b80\u5316 TCP \u670d\u52a1\u5668\u7684\u5f00\u53d1\u3001\u4f7f\u7528 asyncio \u6a21\u5757\u5b9e\u73b0\u5f02\u6b65 TCP \u7f16\u7a0b<\/strong>\u3002\u5176\u4e2d\uff0csocket \u6a21\u5757\u662f\u6700\u57fa\u672c\u7684\u65b9\u6cd5\uff0c\u5b83\u63d0\u4f9b\u4e86\u76f4\u63a5\u64cd\u4f5c\u5957\u63a5\u5b57\u7684\u63a5\u53e3\uff1bsocketserver \u6a21\u5757\u5219\u5728 socket \u7684\u57fa\u7840\u4e0a\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u522b\u7684\u63a5\u53e3\uff0c\u7b80\u5316\u4e86\u670d\u52a1\u5668\u7684\u5f00\u53d1\uff1basyncio \u6a21\u5757\u5219\u9002\u7528\u4e8e\u9700\u8981\u5f02\u6b65\u5904\u7406\u7684\u5927\u91cf\u5e76\u53d1\u8fde\u63a5\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728 Python \u4e2d\u4f7f\u7528\u8fd9\u51e0\u79cd\u65b9\u6cd5\u5b9e\u73b0 TCP \u901a\u4fe1\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528 SOCKET \u6a21\u5757\u5b9e\u73b0 TCP<\/h2>\n<\/p>\n<p><h3>1. \u521b\u5efa TCP \u5ba2\u6237\u7aef<\/h3>\n<\/p>\n<p><p>Python \u7684 socket \u6a21\u5757\u63d0\u4f9b\u4e86\u521b\u5efa TCP \u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u7684\u57fa\u672c\u63a5\u53e3\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684 TCP \u5ba2\u6237\u7aef\uff0c\u9996\u5148\u9700\u8981\u521b\u5efa\u4e00\u4e2a socket \u5bf9\u8c61\uff0c\u7136\u540e\u8fde\u63a5\u5230\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import socket<\/p>\n<p>def tcp_client():<\/p>\n<p>    # \u521b\u5efa\u4e00\u4e2a TCP\/IP \u5957\u63a5\u5b57<\/p>\n<p>    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<\/p>\n<p>    # \u8fde\u63a5\u670d\u52a1\u5668<\/p>\n<p>    server_address = (&#39;localhost&#39;, 10000)<\/p>\n<p>    print(f&#39;Connecting to {server_address[0]} port {server_address[1]}&#39;)<\/p>\n<p>    sock.connect(server_address)<\/p>\n<p>    try:<\/p>\n<p>        # \u53d1\u9001\u6570\u636e<\/p>\n<p>        message = &#39;This is the message. It will be repeated.&#39;<\/p>\n<p>        print(f&#39;Sending: {message}&#39;)<\/p>\n<p>        sock.sendall(message.encode())<\/p>\n<p>        # \u63a5\u6536\u54cd\u5e94<\/p>\n<p>        data = sock.recv(1024)<\/p>\n<p>        print(f&#39;Received: {data.decode()}&#39;)<\/p>\n<p>    finally:<\/p>\n<p>        print(&#39;Closing socket&#39;)<\/p>\n<p>        sock.close()<\/p>\n<p>tcp_client()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u521b\u5efa TCP \u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><p>\u521b\u5efa TCP \u670d\u52a1\u5668\u4e5f\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u521b\u5efa\u4e00\u4e2a socket \u5bf9\u8c61\u5e76\u7ed1\u5b9a\u5230\u6307\u5b9a\u7684\u5730\u5740\u548c\u7aef\u53e3\uff0c\u7136\u540e\u76d1\u542c\u5e76\u63a5\u53d7\u5ba2\u6237\u7aef\u8fde\u63a5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import socket<\/p>\n<p>def tcp_server():<\/p>\n<p>    # \u521b\u5efa TCP\/IP \u5957\u63a5\u5b57<\/p>\n<p>    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<\/p>\n<p>    # \u7ed1\u5b9a\u5957\u63a5\u5b57\u5230\u7aef\u53e3<\/p>\n<p>    server_address = (&#39;localhost&#39;, 10000)<\/p>\n<p>    print(f&#39;Starting up on {server_address[0]} port {server_address[1]}&#39;)<\/p>\n<p>    sock.bind(server_address)<\/p>\n<p>    # \u76d1\u542c\u4f20\u5165\u8fde\u63a5<\/p>\n<p>    sock.listen(1)<\/p>\n<p>    while True:<\/p>\n<p>        # \u7b49\u5f85\u8fde\u63a5<\/p>\n<p>        print(&#39;W<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ting for a connection&#39;)<\/p>\n<p>        connection, client_address = sock.accept()<\/p>\n<p>        try:<\/p>\n<p>            print(f&#39;Connection from {client_address}&#39;)<\/p>\n<p>            # \u63a5\u6536\u6570\u636e\u5e76\u56de\u4f20<\/p>\n<p>            while True:<\/p>\n<p>                data = connection.recv(1024)<\/p>\n<p>                print(f&#39;Received: {data.decode()}&#39;)<\/p>\n<p>                if data:<\/p>\n<p>                    print(&#39;Sending data back to the client&#39;)<\/p>\n<p>                    connection.sendall(data)<\/p>\n<p>                else:<\/p>\n<p>                    print(&#39;No more data from&#39;, client_address)<\/p>\n<p>                    break<\/p>\n<p>        finally:<\/p>\n<p>            # \u6e05\u7406\u8fde\u63a5<\/p>\n<p>            connection.close()<\/p>\n<p>tcp_server()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e8c\u3001\u4f7f\u7528 SOCKETSERVER \u6a21\u5757\u5b9e\u73b0 TCP \u670d\u52a1\u5668<\/h2>\n<\/p>\n<p><p>Python \u7684 socketserver \u6a21\u5757\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u63a5\u53e3\uff0c\u7528\u4e8e\u521b\u5efa TCP \u670d\u52a1\u5668\u3002\u5b83\u7b80\u5316\u4e86\u670d\u52a1\u5668\u7684\u521b\u5efa\u548c\u7ba1\u7406\u3002<\/p>\n<\/p>\n<p><h3>1. \u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684 TCP \u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import socketserver<\/p>\n<p>class MyTCPHandler(socketserver.BaseRequestHandler):<\/p>\n<p>    def handle(self):<\/p>\n<p>        # self.request \u662f TCP \u5957\u63a5\u5b57<\/p>\n<p>        self.data = self.request.recv(1024).strip()<\/p>\n<p>        print(f&#39;{self.client_address[0]} wrote:&#39;)<\/p>\n<p>        print(self.data.decode())<\/p>\n<p>        # \u56de\u4f20\u76f8\u540c\u7684\u6570\u636e<\/p>\n<p>        self.request.sendall(self.data)<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    HOST, PORT = &quot;localhost&quot;, 10000<\/p>\n<p>    # \u521b\u5efa\u670d\u52a1\u5668\uff0c\u7ed1\u5b9a\u5230 localhost:10000<\/p>\n<p>    with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:<\/p>\n<p>        # \u6fc0\u6d3b\u670d\u52a1\u5668\uff1b\u5b83\u4f1a\u4e00\u76f4\u8fd0\u884c\uff0c\u76f4\u5230\u6309\u4e0b\u4e2d\u65ad<\/p>\n<p>        server.serve_forever()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u81ea\u5b9a\u4e49\u8bf7\u6c42\u5904\u7406<\/h3>\n<\/p>\n<p><p>socketserver \u6a21\u5757\u8fd8\u5141\u8bb8\u6211\u4eec\u901a\u8fc7\u7ee7\u627f BaseRequestHandler \u7c7b\u6765\u5b9a\u4e49\u81ea\u5b9a\u4e49\u7684\u8bf7\u6c42\u5904\u7406\u903b\u8f91\u3002\u5728 handle \u65b9\u6cd5\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9e\u73b0\u81ea\u5b9a\u4e49\u7684\u903b\u8f91\u6765\u5904\u7406\u5ba2\u6237\u7aef\u8bf7\u6c42\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u4f7f\u7528 ASYNCIO \u6a21\u5757\u5b9e\u73b0\u5f02\u6b65 TCP<\/h2>\n<\/p>\n<p><h3>1. \u521b\u5efa\u5f02\u6b65 TCP \u5ba2\u6237\u7aef<\/h3>\n<\/p>\n<p><p>asyncio \u6a21\u5757\u63d0\u4f9b\u4e86\u5f02\u6b65 I\/O \u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5b9e\u73b0\u5f02\u6b65 TCP \u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import asyncio<\/p>\n<p>async def tcp_client():<\/p>\n<p>    reader, writer = await asyncio.open_connection(&#39;127.0.0.1&#39;, 10000)<\/p>\n<p>    message = &#39;Hello World!&#39;<\/p>\n<p>    print(f&#39;Send: {message}&#39;)<\/p>\n<p>    writer.write(message.encode())<\/p>\n<p>    data = await reader.read(100)<\/p>\n<p>    print(f&#39;Received: {data.decode()}&#39;)<\/p>\n<p>    print(&#39;Close the connection&#39;)<\/p>\n<p>    writer.close()<\/p>\n<p>    await writer.wait_closed()<\/p>\n<p>asyncio.run(tcp_client())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u521b\u5efa\u5f02\u6b65 TCP \u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import asyncio<\/p>\n<p>async def handle_echo(reader, writer):<\/p>\n<p>    data = await reader.read(100)<\/p>\n<p>    message = data.decode()<\/p>\n<p>    addr = writer.get_extra_info(&#39;peername&#39;)<\/p>\n<p>    print(f&quot;Received {message} from {addr}&quot;)<\/p>\n<p>    print(&quot;Send: %s&quot; % message)<\/p>\n<p>    writer.write(data)<\/p>\n<p>    await writer.drain()<\/p>\n<p>    print(&quot;Close the connection&quot;)<\/p>\n<p>    writer.close()<\/p>\n<p>async def main():<\/p>\n<p>    server = await asyncio.start_server(handle_echo, &#39;127.0.0.1&#39;, 10000)<\/p>\n<p>    addr = server.sockets[0].getsockname()<\/p>\n<p>    print(f&#39;Serving on {addr}&#39;)<\/p>\n<p>    async with server:<\/p>\n<p>        await server.serve_forever()<\/p>\n<p>asyncio.run(main())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u56db\u3001TCP \u7f16\u7a0b\u4e2d\u7684\u5e38\u89c1\u95ee\u9898\u548c\u89e3\u51b3\u65b9\u6848<\/h2>\n<\/p>\n<p><h3>1. \u5904\u7406\u7c98\u5305\u95ee\u9898<\/h3>\n<\/p>\n<p><p>\u5728 TCP \u534f\u8bae\u4e2d\uff0c\u7c98\u5305\u95ee\u9898\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u95ee\u9898\u3002\u5b83\u901a\u5e38\u662f\u7531\u4e8e\u7f51\u7edc\u7684\u5f02\u6b65\u7279\u6027\u5bfc\u81f4\u7684\uff0c\u53d1\u9001\u7684\u6570\u636e\u5305\u53ef\u80fd\u4f1a\u88ab\u5408\u5e76\u5728\u4e00\u8d77\u3002\u89e3\u51b3\u7c98\u5305\u95ee\u9898\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u6bd4\u5982\u5728\u6bcf\u4e2a\u6d88\u606f\u524d\u52a0\u4e0a\u957f\u5ea6\u4fe1\u606f\uff0c\u6216\u8005\u4f7f\u7528\u7279\u5b9a\u7684\u5206\u9694\u7b26\u3002<\/p>\n<\/p>\n<p><h3>2. \u5f02\u5e38\u5904\u7406<\/h3>\n<\/p>\n<p><p>\u5728\u8fdb\u884c\u7f51\u7edc\u7f16\u7a0b\u65f6\uff0c\u5f02\u5e38\u5904\u7406\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u9700\u8981\u5904\u7406\u7684\u5f02\u5e38\u5305\u62ec\u8fde\u63a5\u5931\u8d25\u3001\u8bfb\u53d6\u6216\u5199\u5165\u5931\u8d25\u7b49\u3002\u5728 Python \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 try-except \u5757\u6765\u6355\u83b7\u5e76\u5904\u7406\u8fd9\u4e9b\u5f02\u5e38\u3002<\/p>\n<\/p>\n<p><h3>3. \u6027\u80fd\u4f18\u5316<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5927\u91cf\u5e76\u53d1\u8fde\u63a5\u65f6\uff0c\u6027\u80fd\u4f18\u5316\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u95ee\u9898\u3002\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u5f02\u6b65\u7f16\u7a0b\uff08\u5982 asyncio\uff09\u6216\u591a\u7ebf\u7a0b\u3001\u591a\u8fdb\u7a0b\u7f16\u7a0b\u6765\u63d0\u9ad8\u670d\u52a1\u5668\u7684\u6027\u80fd\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u603b\u7ed3<\/h2>\n<\/p>\n<p><p>Python \u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u5b9e\u73b0 TCP \u901a\u4fe1\uff0c\u5305\u62ec\u4f7f\u7528 socket \u6a21\u5757\u7684\u57fa\u7840\u65b9\u6cd5\u3001socketserver \u6a21\u5757\u7684\u9ad8\u7ea7\u63a5\u53e3\uff0c\u4ee5\u53ca asyncio \u6a21\u5757\u7684\u5f02\u6b65\u7f16\u7a0b\u63a5\u53e3\u3002\u6839\u636e\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\u548c\u9700\u6c42\uff0c\u53ef\u4ee5\u9009\u62e9\u4e0d\u540c\u7684\u65b9\u6cd5\u6765\u5b9e\u73b0 TCP \u901a\u4fe1\u3002\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u9700\u8981\u6ce8\u610f\u5904\u7406\u7c98\u5305\u95ee\u9898\u3001\u5f02\u5e38\u5904\u7406\u548c\u6027\u80fd\u4f18\u5316\u7b49\u95ee\u9898\u3002\u901a\u8fc7\u5408\u7406\u7684\u8bbe\u8ba1\u548c\u5b9e\u73b0\uff0c\u53ef\u4ee5\u6784\u5efa\u9ad8\u6548\u3001\u53ef\u9760\u7684 TCP \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684TCP\u670d\u52a1\u5668\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528socket\u5e93\u6765\u521b\u5efaTCP\u670d\u52a1\u5668\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u5bfc\u5165socket\u6a21\u5757\uff0c\u7136\u540e\u521b\u5efa\u4e00\u4e2asocket\u5bf9\u8c61\uff0c\u7ed1\u5b9a\u5230\u7279\u5b9a\u7684IP\u5730\u5740\u548c\u7aef\u53e3\u4e0a\u3002\u63a5\u7740\uff0c\u60a8\u53ef\u4ee5\u8c03\u7528listen()\u65b9\u6cd5\u5f00\u59cb\u76d1\u542c\u5ba2\u6237\u7aef\u8fde\u63a5\u3002\u901a\u8fc7accept()\u65b9\u6cd5\uff0c\u670d\u52a1\u5668\u53ef\u4ee5\u63a5\u6536\u6765\u81ea\u5ba2\u6237\u7aef\u7684\u8fde\u63a5\u8bf7\u6c42\uff0c\u5e76\u901a\u8fc7recv()\u548csend()\u65b9\u6cd5\u8fdb\u884c\u6570\u636e\u4ea4\u6d41\u3002<\/p>\n<p><strong>Python\u7684TCP\u5ba2\u6237\u7aef\u5982\u4f55\u4e0e\u670d\u52a1\u5668\u8fdb\u884c\u901a\u4fe1\uff1f<\/strong><br \/>\u8981\u521b\u5efaTCP\u5ba2\u6237\u7aef\uff0c\u60a8\u540c\u6837\u9700\u8981\u4f7f\u7528socket\u5e93\u3002\u5ba2\u6237\u7aef\u9700\u8981\u521b\u5efasocket\u5bf9\u8c61\u5e76\u8fde\u63a5\u5230\u670d\u52a1\u5668\u7684IP\u5730\u5740\u548c\u7aef\u53e3\u3002\u8fde\u63a5\u6210\u529f\u540e\uff0c\u5ba2\u6237\u7aef\u53ef\u4ee5\u4f7f\u7528send()\u65b9\u6cd5\u5411\u670d\u52a1\u5668\u53d1\u9001\u6570\u636e\uff0c\u540c\u65f6\u901a\u8fc7recv()\u65b9\u6cd5\u63a5\u6536\u670d\u52a1\u5668\u7684\u54cd\u5e94\u3002\u786e\u4fdd\u5728\u901a\u4fe1\u7ed3\u675f\u540e\u8c03\u7528close()\u65b9\u6cd5\u4ee5\u5173\u95ed\u8fde\u63a5\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5b9e\u73b0TCP\u65f6\uff0c\u5982\u4f55\u5904\u7406\u5f02\u5e38\u548c\u9519\u8bef\uff1f<\/strong><br \/>\u5728\u5b9e\u73b0TCP\u901a\u4fe1\u65f6\uff0c\u5904\u7406\u5f02\u5e38\u548c\u9519\u8bef\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u4f7f\u7528try-except\u5757\u53ef\u4ee5\u6355\u6349\u7f51\u7edc\u9519\u8bef\uff0c\u5982ConnectionError\u3001TimeoutError\u7b49\u3002\u5f53\u51fa\u73b0\u5f02\u5e38\u65f6\uff0c\u53ef\u4ee5\u8bb0\u5f55\u9519\u8bef\u4fe1\u606f\u5e76\u91c7\u53d6\u5fc5\u8981\u7684\u63aa\u65bd\uff0c\u4f8b\u5982\u91cd\u8bd5\u8fde\u63a5\u6216\u901a\u77e5\u7528\u6237\u3002\u786e\u4fdd\u5728\u5f02\u5e38\u5904\u7406\u90e8\u5206\u91ca\u653e\u8d44\u6e90\uff0c\u4ee5\u9632\u6b62\u5185\u5b58\u6cc4\u6f0f\u6216\u5176\u4ed6\u95ee\u9898\u7684\u53d1\u751f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python \u5b9e\u73b0 TCP \u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528 socket \u6a21\u5757\u521b\u5efa TCP \u5957\u63a5\u5b57\u3001\u5229\u7528 socketser [&hellip;]","protected":false},"author":3,"featured_media":929625,"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\/929619"}],"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=929619"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/929619\/revisions"}],"predecessor-version":[{"id":929626,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/929619\/revisions\/929626"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/929625"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=929619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=929619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=929619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}