{"id":1998,"date":"2024-10-07T16:37:58","date_gmt":"2024-10-07T08:37:58","guid":{"rendered":"http:\/\/blog.xtaa.cn\/?p=1998"},"modified":"2024-10-07T16:37:58","modified_gmt":"2024-10-07T08:37:58","slug":"%e8%a7%a3%e5%af%86tenacity%ef%bc%9apython%e4%b8%ad%e6%9c%80%e5%bc%ba%e5%a4%a7%e7%9a%84%e9%87%8d%e8%af%95%e5%ba%93","status":"publish","type":"post","link":"http:\/\/blog.xtaa.cn\/index.php\/2024\/10\/07\/%e8%a7%a3%e5%af%86tenacity%ef%bc%9apython%e4%b8%ad%e6%9c%80%e5%bc%ba%e5%a4%a7%e7%9a%84%e9%87%8d%e8%af%95%e5%ba%93\/","title":{"rendered":"\u89e3\u5bc6Tenacity\uff1aPython\u4e2d\u6700\u5f3a\u5927\u7684\u91cd\u8bd5\u5e93"},"content":{"rendered":"\n<p>\u5728\u7f16\u5199\u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u7ecf\u5e38\u9700\u8981\u5904\u7406\u4e0e\u5916\u90e8\u670d\u52a1\u901a\u4fe1\u6216\u5176\u4ed6\u4e0d\u7a33\u5b9a\u64cd\u4f5c\u76f8\u5173\u7684\u95ee\u9898\u3002\u8fd9\u4e9b\u95ee\u9898\u53ef\u80fd\u5305\u62ec\u7f51\u7edc\u9519\u8bef\u3001\u670d\u52a1\u4e0d\u53ef\u7528\u3001\u8d85\u65f6\u7b49\u3002\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c\u91cd\u8bd5\u64cd\u4f5c\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u89e3\u51b3\u65b9\u6848\u3002Tenacity\u662fPython\u4e2d\u4e00\u4e2a\u5f3a\u5927\u4e14\u7075\u6d3b\u7684\u91cd\u8bd5\u5e93\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u4f60\u6709\u6548\u5730\u5904\u7406\u8fd9\u4e9b\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u8fd9\u7bc7\u6587\u7ae0\u5c06\u4ecb\u7ecdTenacity\u91cd\u8bd5\u5e93\u7684\u4f7f\u7528\uff0c\u5305\u62ec\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6eTenacity\uff0c\u4ee5\u53ca\u5982\u4f55\u5728\u4e0d\u540c\u573a\u666f\u4e0b\u4f7f\u7528\u5b83\u6765\u5904\u7406\u91cd\u8bd5\u64cd\u4f5c\u3002\u8fd8\u6709Tenacity\u7684\u5404\u79cd\u529f\u80fd\u548c\u9009\u9879\uff0c\u5e76\u63d0\u4f9b\u4e30\u5bcc\u7684\u793a\u4f8b\u4ee3\u7801\u6765\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u5982\u4f55\u5e94\u7528\u5b83\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u5b89\u88c5Tenacity<\/strong><\/h2>\n\n\n\n<p>\u9996\u5148\uff0c\u5b89\u88c5Tenacity\u5e93\u3002\u4f7f\u7528pip\u6765\u5b89\u88c5Tenacity\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install tenacity\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u57fa\u672c\u7528\u6cd5<\/strong><\/h2>\n\n\n\n<p>Tenacity\u7684\u57fa\u672c\u601d\u60f3\u662f\u5b9a\u4e49\u4e00\u4e2a\u88c5\u9970\u5668\uff0c\u8be5\u88c5\u9970\u5668\u53ef\u4ee5\u5e94\u7528\u4e8e\u51fd\u6570\u6216\u65b9\u6cd5\uff0c\u4ee5\u5b9e\u73b0\u81ea\u52a8\u91cd\u8bd5\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from tenacity import retry, stop_after_attempt\n\n@retry(stop=stop_after_attempt(3))\ndef do_something():\n    print(\"Doing something...\")\n    raise Exception(\"Something went wrong!\")\n\ntry:\n    do_something()\nexcept Exception as e:\n    print(f\"Exception: {e}\")\n<\/code><\/pre>\n\n\n\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u4f7f\u7528<code>@retry<\/code>\u88c5\u9970\u5668\u6765\u4fee\u9970<code>do_something<\/code>\u51fd\u6570\u3002\u914d\u7f6e\u4e86\u91cd\u8bd5\u7b56\u7565\uff0c\u5373\u5728\u524d\u4e09\u6b21\u5c1d\u8bd5\u540e\u505c\u6b62\u91cd\u8bd5\uff08<code>stop_after_attempt(3)<\/code>\uff09\u3002\u5728<code>do_something<\/code>\u51fd\u6570\u4e2d\uff0c\u6a21\u62df\u4e86\u4e00\u4e2a\u5931\u8d25\u7684\u64cd\u4f5c\uff0c\u89e6\u53d1\u4e86\u5f02\u5e38\u3002\u7531\u4e8e\u914d\u7f6e\u4e86\u91cd\u8bd5\uff0cTenacity\u5c06\u5728\u5f02\u5e38\u53d1\u751f\u65f6\u81ea\u52a8\u91cd\u8bd5\u8be5\u51fd\u6570\uff0c\u6700\u591a\u91cd\u8bd53\u6b21\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u914d\u7f6e\u9009\u9879<\/strong><\/h2>\n\n\n\n<p>Tenacity\u63d0\u4f9b\u4e86\u8bb8\u591a\u914d\u7f6e\u9009\u9879\uff0c\u53ef\u4ee5\u6ee1\u8db3\u4e0d\u540c\u573a\u666f\u7684\u9700\u6c42\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u914d\u7f6e\u9009\u9879\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>wait<\/code>\uff1a\u5b9a\u4e49\u91cd\u8bd5\u4e4b\u95f4\u7684\u7b49\u5f85\u65f6\u95f4\uff0c\u53ef\u4ee5\u662f\u56fa\u5b9a\u7684\u65f6\u95f4\u95f4\u9694\u6216\u6839\u636e\u6307\u6570\u9012\u589e\u7684\u65f6\u95f4\u95f4\u9694\u3002<\/li>\n\n\n\n<li><code>stop<\/code>\uff1a\u5b9a\u4e49\u4f55\u65f6\u505c\u6b62\u91cd\u8bd5\uff0c\u53ef\u4ee5\u6839\u636e\u5c1d\u8bd5\u6b21\u6570\u3001\u603b\u65f6\u95f4\u6216\u5176\u4ed6\u6761\u4ef6\u505c\u6b62\u3002<\/li>\n\n\n\n<li><code>retry<\/code>\uff1a\u5b9a\u4e49\u5728\u54ea\u4e9b\u5f02\u5e38\u60c5\u51b5\u4e0b\u6267\u884c\u91cd\u8bd5\uff0c\u53ef\u4ee5\u6839\u636e\u5f02\u5e38\u7c7b\u578b\u3001\u81ea\u5b9a\u4e49\u6761\u4ef6\u6216\u81ea\u5b9a\u4e49<a href=\"https:\/\/www.zhihu.com\/search?q=%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0&amp;search_source=Entity&amp;hybrid_search_source=Entity&amp;hybrid_search_extra=%7B%22sourceType%22%3A%22article%22%2C%22sourceId%22%3A667987317%7D\" target=\"_blank\" rel=\"noreferrer noopener\">\u56de\u8c03\u51fd\u6570<\/a>\u6267\u884c\u3002<\/li>\n\n\n\n<li><code>before_sleep<\/code>\uff1a\u5728\u6bcf\u6b21\u91cd\u8bd5\u4e4b\u524d\u6267\u884c\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u7528\u4e8e\u6267\u884c\u6e05\u7406\u6216\u65e5\u5fd7\u8bb0\u5f55\u7b49\u4efb\u52a1\u3002<\/li>\n\n\n\n<li><code>reraise<\/code>\uff1a\u662f\u5426\u91cd\u65b0\u5f15\u53d1\u5f02\u5e38\uff0c\u5982\u679c\u8bbe\u7f6e\u4e3a<code>True<\/code>\uff0c\u5219\u5728\u8fbe\u5230\u6700\u5927\u91cd\u8bd5\u6b21\u6570\u540e\u4f1a\u5f15\u53d1\u539f\u59cb\u5f02\u5e38\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u793a\u4f8b\u4ee3\u7801<\/strong><\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u66f4\u591a\u793a\u4f8b\u4ee3\u7801\uff0c\u6f14\u793a\u4e86Tenacity\u7684\u4e0d\u540c\u7528\u6cd5\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u81ea\u5b9a\u4e49\u91cd\u8bd5\u6761\u4ef6<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>from tenacity import retry, stop_after_attempt, retry_if_exception_type\n\n@retry(\n    stop=stop_after_attempt(5),\n    retry=retry_if_exception_type(IOError)\n)\ndef open_file(file_path):\n    print(f\"Opening file: {file_path}\")\n    raise IOError(\"File not found\")\n\ntry:\n    open_file(\"example.txt\")\nexcept IOError as e:\n    print(f\"Exception: {e}\")\n<\/code><\/pre>\n\n\n\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u5b9a\u4e49\u4e86\u81ea\u5b9a\u4e49\u7684\u91cd\u8bd5\u6761\u4ef6\uff0c\u4ec5\u5f53\u6355\u83b7\u5230<code>IOError<\/code>\u5f02\u5e38\u65f6\u624d\u91cd\u8bd5\uff0c\u6700\u591a\u91cd\u8bd55\u6b21\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u914d\u7f6e\u7b49\u5f85\u65f6\u95f4<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>from tenacity import retry, wait_fixed\n\n@retry(wait=wait_fixed(2))\ndef slow_function():\n    print(\"Slow function running...\")\n    raise Exception(\"Something went wrong!\")\n\ntry:\n    slow_function()\nexcept Exception as e:\n    print(f\"Exception: {e}\")\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u914d\u7f6e\u4e86\u4e00\u4e2a\u56fa\u5b9a\u7684\u7b49\u5f85\u65f6\u95f4\u4e3a2\u79d2\uff0c\u8868\u793a\u5728\u6bcf\u6b21\u91cd\u8bd5\u4e4b\u95f4\u7b49\u5f852\u79d2\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4f7f\u7528before_sleep\u56de\u8c03<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>from tenacity import retry, wait_fixed, before_sleep_log\n\n@retry(wait=wait_fixed(2), before_sleep=before_sleep_log(logger))\ndef some_operation():\n    print(\"Doing some operation...\")\n    raise Exception(\"Failed!\")\n\ntry:\n    some_operation()\nexcept Exception as e:\n    print(f\"Exception: {e}\")\n<\/code><\/pre>\n\n\n\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4f7f\u7528\u4e86<code>before_sleep<\/code>\u56de\u8c03\u51fd\u6570\uff0c\u5b83\u4f1a\u5728\u6bcf\u6b21\u91cd\u8bd5\u4e4b\u524d\u6267\u884c\uff0c\u5e76\u901a\u8fc7\u65e5\u5fd7\u8bb0\u5f55\u7b49\u5f85\u65f6\u95f4\u3002\u8fd9\u6709\u52a9\u4e8e\u66f4\u597d\u5730\u7406\u89e3Tenacity\u7684\u5de5\u4f5c\u65b9\u5f0f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u9ad8\u7ea7\u7528\u6cd5<\/strong><\/h2>\n\n\n\n<p>Tenacity\u63d0\u4f9b\u4e86\u8bb8\u591a\u9ad8\u7ea7\u529f\u80fd\uff0c\u589e\u5f3a\u4e86\u5176\u7075\u6d3b\u6027\u548c\u9002\u7528\u6027\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u7b80\u8981\u4ecb\u7ecd\u4e00\u4e9b\u9ad8\u7ea7\u7528\u6cd5\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Jitter\u914d\u7f6e\uff1a<\/strong><\/li>\n<\/ol>\n\n\n\n<p>Tenacity\u652f\u6301\u914d\u7f6eJitter\uff0c\u8fd9\u662f\u4e00\u79cd\u968f\u673a\u6027\u7684\u7b49\u5f85\u65f6\u95f4\uff0c\u6709\u52a9\u4e8e\u907f\u514d\u6240\u6709\u91cd\u8bd5\u64cd\u4f5c\u540c\u65f6\u8fdb\u884c\u3002\u901a\u8fc7\u914d\u7f6eJitter\uff0c\u53ef\u4ee5\u4f7f\u91cd\u8bd5\u64cd\u4f5c\u5728\u4e00\u5b9a\u7684\u65f6\u95f4\u8303\u56f4\u5185\u968f\u673a\u5206\u6563\u6267\u884c\uff0c\u51cf\u8f7b\u4e86\u670d\u52a1\u7684\u8d1f\u8f7d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from tenacity import retry, wait_random\n\n@retry(wait=wait_random(min=1, max=5))\ndef operation_with_jitter():\n    print(\"Operation with Jitter...\")\n    raise Exception(\"Failed!\")\n\ntry:\n    operation_with_jitter()\nexcept Exception as e:\n    print(f\"Exception: {e}\")\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u7b49\u5f85\u53ef\u91cd\u8bd5\u6761\u4ef6\uff1a<\/strong><\/li>\n<\/ol>\n\n\n\n<p>\u53ef\u4ee5\u5b9a\u4e49\u81ea\u5b9a\u4e49\u7684\u53ef\u91cd\u8bd5\u6761\u4ef6\uff0c\u4ee5\u6ee1\u8db3\u7279\u5b9a\u7684\u5e94\u7528\u573a\u666f\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5728\u67d0\u4e2a\u72b6\u6001\u6ee1\u8db3\u65f6\u624d\u89e6\u53d1\u91cd\u8bd5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from tenacity import retry, retry_if_result, stop_after_attempt\n\ndef should_retry(result):\n    return result is not None\n\n@retry(retry=retry_if_result(should_retry), stop=stop_after_attempt(3))\ndef operation_with_custom_retry_condition():\n    result = do_operation()\n    return result\n\ndef do_operation():\n    print(\"Doing operation...\")\n    return None\n\ntry:\n    operation_with_custom_retry_condition()\nexcept Exception as e:\n    print(f\"Exception: {e}\")\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u81ea\u5b9a\u4e49\u505c\u6b62\u7b56\u7565\uff1a<\/strong>\u00a0Tenacity\u5141\u8bb8<\/li>\n<\/ol>\n\n\n\n<p>\u81ea\u5b9a\u4e49\u505c\u6b62\u7b56\u7565\uff0c\u4ee5\u4fbf\u5728\u7279\u5b9a\u6761\u4ef6\u4e0b\u505c\u6b62\u91cd\u8bd5\u3002\u8fd9\u53ef\u4ee5\u662f\u57fa\u4e8e\u5f02\u5e38\u7c7b\u578b\u3001\u5c1d\u8bd5\u6b21\u6570\u3001\u603b\u65f6\u95f4\u6216\u5176\u4ed6\u6761\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from tenacity import retry, stop_after_delay, retry_if_exception\n\ndef custom_stop_predicate(retry_state):\n    return retry_state.outcome.exception is not None\n\n@retry(stop=stop_after_delay(10) | stop_after_attempt(5), retry=retry_if_exception())\ndef operation_with_custom_stop():\n    print(\"Operation with Custom Stop...\")\n    raise Exception(\"Failed!\")\n\ntry:\n    operation_with_custom_stop()\nexcept Exception as e:\n    print(f\"Exception: {e}\")\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u603b\u7ed3<\/strong><\/h2>\n\n\n\n<p>\u5728\u5f00\u53d1Python\u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u5904\u7406\u4e0d\u7a33\u5b9a\u7684\u64cd\u4f5c\u548c\u9519\u8bef\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u6311\u6218\u3002Tenacity\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u91cd\u8bd5\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u4f18\u96c5\u5730\u5e94\u5bf9\u5404\u79cd\u5931\u8d25\u548c\u5f02\u5e38\u60c5\u51b5\u3002\u901a\u8fc7\u5408\u7406\u914d\u7f6eTenacity\u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u5b9e\u73b0\u7075\u6d3b\u7684\u91cd\u8bd5\u7b56\u7565\uff0c\u9002\u5e94\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\u3002<\/p>\n\n\n\n<p>\u8fd9\u7bc7\u6587\u7ae0\u4ecb\u7ecd\u4e86Tenacity\u7684\u57fa\u672c\u7528\u6cd5\uff0c\u5305\u62ec\u5982\u4f55\u88c5\u9970\u51fd\u6570\u4ee5\u542f\u7528\u91cd\u8bd5\u3001\u5982\u4f55\u914d\u7f6e\u91cd\u8bd5\u7684\u7b49\u5f85\u7b56\u7565\u3001\u5982\u4f55\u5904\u7406\u7279\u5b9a\u7684\u5f02\u5e38\u7c7b\u578b\u7b49\u3002\u8fd8\u5206\u4eab\u4e86Tenacity\u7684\u9ad8\u7ea7\u529f\u80fd\uff0c\u5982Jitter\u914d\u7f6e\u3001\u81ea\u5b9a\u4e49\u53ef\u91cd\u8bd5\u6761\u4ef6\u548c\u505c\u6b62\u7b56\u7565\uff0c\u80fd\u591f\u66f4\u597d\u5730\u9002\u5e94\u590d\u6742\u7684\u5e94\u7528\u9700\u6c42\u3002<\/p>\n\n\n\n<p>\u65e0\u8bba\u662f\u5904\u7406\u7f51\u7edc\u8bf7\u6c42\u3001\u6587\u4ef6\u64cd\u4f5c\u8fd8\u662f\u5176\u4ed6\u53ef\u80fd\u51fa\u73b0\u9519\u8bef\u7684\u60c5\u51b5\uff0cTenacity\u90fd\u53ef\u4ee5\u5e2e\u52a9\u4f60\u63d0\u9ad8\u5e94\u7528\u7a0b\u5e8f\u7684\u53ef\u9760\u6027\u3002\u5b83\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u4ef7\u503c\u7684\u5de5\u5177\uff0c\u7279\u522b\u9002\u7528\u4e8e\u9700\u8981\u5904\u7406\u4e0d\u7a33\u5b9a\u64cd\u4f5c\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5982\u5206\u5e03\u5f0f\u7cfb\u7edf\u3001<a href=\"https:\/\/www.zhihu.com\/search?q=%E5%BE%AE%E6%9C%8D%E5%8A%A1&amp;search_source=Entity&amp;hybrid_search_source=Entity&amp;hybrid_search_extra=%7B%22sourceType%22%3A%22article%22%2C%22sourceId%22%3A667987317%7D\" target=\"_blank\" rel=\"noreferrer noopener\">\u5fae\u670d\u52a1<\/a>\u548cAPI\u8c03\u7528\u3002<\/p>\n\n\n\n<p>\u901a\u8fc7\u638c\u63e1Tenacity\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u4fdd\u62a4\u4f60\u5e94\u7528\u7a0b\u5e8f\u514d\u53d7\u610f\u5916\u9519\u8bef\u7684\u5f71\u54cd\uff0c\u63d0\u4f9b\u66f4\u597d\u7684\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u7f16\u5199\u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u7ecf\u5e38\u9700\u8981\u5904\u7406\u4e0e\u5916\u90e8\u670d\u52a1\u901a\u4fe1\u6216\u5176\u4ed6\u4e0d\u7a33\u5b9a\u64cd\u4f5c\u76f8\u5173\u7684\u95ee\u9898\u3002\u8fd9\u4e9b\u95ee\u9898\u53ef\u80fd\u5305\u62ec\u7f51\u7edc\u9519\u8bef\u3001\u670d\u52a1\u4e0d\u53ef\u7528\u3001 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-1998","post","type-post","status-publish","format-standard","hentry","category-10"],"_links":{"self":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts\/1998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1998"}],"version-history":[{"count":1,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts\/1998\/revisions"}],"predecessor-version":[{"id":1999,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts\/1998\/revisions\/1999"}],"wp:attachment":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1998"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}