{"id":936934,"date":"2024-12-26T19:40:05","date_gmt":"2024-12-26T11:40:05","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/936934.html"},"modified":"2024-12-26T19:40:06","modified_gmt":"2024-12-26T11:40:06","slug":"python%e5%a6%82%e4%bd%95%e4%b8%8ewordpress","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/936934.html","title":{"rendered":"python\u5982\u4f55\u4e0ewordpress"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25072940\/414bf001-142d-4c83-aa26-0f0bbedad909.webp\" alt=\"python\u5982\u4f55\u4e0ewordpress\" \/><\/p>\n<p><p> <strong>Python\u4e0eWordPress\u96c6\u6210\u7684\u4e3b\u8981\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528WordPress REST API\u4e0ePython\u4ea4\u4e92\u3001\u4f7f\u7528Python\u5e93\u5982<code>python-wordpress-xmlrpc<\/code>\u4e0eWordPress\u8fdb\u884cXML-RPC\u901a\u4fe1\u3001\u901a\u8fc7\u7b2c\u4e09\u65b9\u5de5\u5177\u6216\u63d2\u4ef6\u6269\u5c55Python\u4e0eWordPress\u7684\u529f\u80fd\u3002<\/strong>\u5728\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\uff0c\u4f7f\u7528WordPress REST API \u662f\u6700\u4e3a\u7075\u6d3b\u548c\u73b0\u4ee3\u5316\u7684\u65b9\u5f0f\uff0c\u5b83\u5141\u8bb8\u4f60\u901a\u8fc7HTTP\u8bf7\u6c42\u4e0eWordPress\u7f51\u7ad9\u8fdb\u884c\u6570\u636e\u4ea4\u4e92\u3002REST API \u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u7aef\u70b9\uff0c\u53ef\u4ee5\u83b7\u53d6\u3001\u521b\u5efa\u3001\u66f4\u65b0\u548c\u5220\u9664WordPress\u7f51\u7ad9\u4e0a\u7684\u5404\u79cd\u6570\u636e\uff0c\u5982\u6587\u7ae0\u3001\u9875\u9762\u3001\u8bc4\u8bba\u7b49\u3002\u8be6\u7ec6\u6765\u8bf4\uff0cREST API \u7684\u4f18\u52bf\u5728\u4e8e\u5176\u5e73\u53f0\u65e0\u5173\u6027\u548c\u6613\u7528\u6027\uff0c\u5b83\u4e0d\u4ec5\u652f\u6301GET\u3001POST\u3001PUT\u3001DELETE\u7b49HTTP\u52a8\u8bcd\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7JSON\u683c\u5f0f\u4f20\u9012\u6570\u636e\uff0c\u8fd9\u4f7f\u5f97\u6570\u636e\u7684\u64cd\u4f5c\u53d8\u5f97\u975e\u5e38\u76f4\u89c2\u548c\u7b80\u6d01\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528WORDPRESS REST API<\/p>\n<\/p>\n<p><p>WordPress REST API \u662f\u4e00\u79cd\u57fa\u4e8eHTTP\u534f\u8bae\u7684\u63a5\u53e3\uff0c\u5b83\u5141\u8bb8\u5f00\u53d1\u8005\u901a\u8fc7API\u8bbf\u95eeWordPress\u7f51\u7ad9\u7684\u5185\u5bb9\u548c\u529f\u80fd\u3002\u901a\u8fc7REST API\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528Python\u811a\u672c\u53d1\u9001HTTP\u8bf7\u6c42\u6765\u4e0eWordPress\u8fdb\u884c\u4ea4\u4e92\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5\u548c\u914d\u7f6e<\/strong><\/li>\n<\/ol>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684WordPress\u7f51\u7ad9\u542f\u7528\u4e86REST API\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWordPress 4.7\u53ca\u4ee5\u4e0a\u7248\u672c\u5df2\u7ecf\u5185\u7f6e\u4e86REST API\u3002\u56e0\u6b64\uff0c\u4f60\u53ea\u9700\u786e\u4fdd\u7f51\u7ad9\u6b63\u5e38\u8fd0\u884c\u5373\u53ef\u3002\u63a5\u4e0b\u6765\uff0c\u4f60\u9700\u8981\u4e00\u4e2aHTTP\u5ba2\u6237\u7aef\u5e93\u6765\u53d1\u9001\u8bf7\u6c42\u3002\u5728Python\u4e2d\uff0c<code>requests<\/code>\u5e93\u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u9009\u62e9\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u5b83\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u57fa\u672c\u8bf7\u6c42<\/strong><\/li>\n<\/ol>\n<p><p>\u4e00\u65e6\u4f60\u5b89\u88c5\u4e86<code>requests<\/code>\u5e93\uff0c\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528Python\u811a\u672c\u53d1\u9001GET\u8bf7\u6c42\u6765\u83b7\u53d6WordPress\u7f51\u7ad9\u4e0a\u7684\u6570\u636e\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u83b7\u53d6\u6700\u65b0\u7684\u6587\u7ae0\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import requests<\/p>\n<p>url = &quot;https:\/\/example.com\/wp-json\/wp\/v2\/posts&quot;<\/p>\n<p>response = requests.get(url)<\/p>\n<p>if response.status_code == 200:<\/p>\n<p>    posts = response.json()<\/p>\n<p>    for post in posts:<\/p>\n<p>        print(f&quot;Title: {post[&#39;title&#39;][&#39;rendered&#39;]}&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;F<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>led to retrieve posts&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528GET\u8bf7\u6c42\u4eceWordPress\u7f51\u7ad9\u7684REST API\u7aef\u70b9\u83b7\u53d6\u6587\u7ae0\u5217\u8868\uff0c\u5e76\u4ee5JSON\u683c\u5f0f\u89e3\u6790\u54cd\u5e94\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li><strong>\u8ba4\u8bc1<\/strong><\/li>\n<\/ol>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u8ba4\u8bc1\u7684\u64cd\u4f5c\uff08\u5982\u521b\u5efa\u3001\u66f4\u65b0\u6216\u5220\u9664\u6587\u7ae0\uff09\uff0c\u4f60\u9700\u8981\u4f7f\u7528WordPress\u7684\u8ba4\u8bc1\u673a\u5236\u3002\u5e38\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u6709\u4e24\u79cd\uff1aCookie\u8ba4\u8bc1\u548c\u57fa\u4e8e\u5e94\u7528\u5bc6\u7801\u7684\u8ba4\u8bc1\u3002\u5e94\u7528\u5bc6\u7801\u662f\u4e00\u79cd\u63a8\u8350\u7684\u8ba4\u8bc1\u65b9\u5f0f\uff0c\u56e0\u4e3a\u5b83\u66f4\u52a0\u5b89\u5168\u548c\u6613\u4e8e\u7ba1\u7406\u3002<\/p>\n<\/p>\n<p><p>\u8981\u4f7f\u7528\u5e94\u7528\u5bc6\u7801\u8fdb\u884c\u8ba4\u8bc1\uff0c\u9996\u5148\u9700\u8981\u5728WordPress\u540e\u53f0\u4e3a\u4f60\u7684\u7528\u6237\u751f\u6210\u4e00\u4e2a\u5e94\u7528\u5bc6\u7801\u3002\u7136\u540e\uff0c\u4f60\u53ef\u4ee5\u5728Python\u811a\u672c\u4e2d\u4f7f\u7528<code>requests<\/code>\u5e93\u53d1\u9001\u8ba4\u8bc1\u8bf7\u6c42\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import requests<\/p>\n<p>from requests.auth import HTTPBasicAuth<\/p>\n<p>url = &quot;https:\/\/example.com\/wp-json\/wp\/v2\/posts&quot;<\/p>\n<p>auth = HTTPBasicAuth(&#39;your_username&#39;, &#39;your_application_password&#39;)<\/p>\n<p>response = requests.get(url, auth=auth)<\/p>\n<p>if response.status_code == 200:<\/p>\n<p>    posts = response.json()<\/p>\n<p>    for post in posts:<\/p>\n<p>        print(f&quot;Title: {post[&#39;title&#39;][&#39;rendered&#39;]}&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;Failed to retrieve posts&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u53ef\u4ee5\u5b89\u5168\u5730\u4f7f\u7528Python\u4e0eWordPress REST API\u8fdb\u884c\u8ba4\u8bc1\u7684\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528PYTHON-WORDPRESS-XMLRPC\u5e93<\/p>\n<\/p>\n<p><p>\u9664\u4e86REST API\uff0cWordPress\u8fd8\u652f\u6301XML-RPC\u534f\u8bae\u6765\u8fdb\u884c\u8fdc\u7a0b\u901a\u4fe1\u3002<code>python-wordpress-xmlrpc<\/code>\u5e93\u662f\u4e00\u4e2a\u6d41\u884c\u7684Python\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u901a\u8fc7XML-RPC\u4e0eWordPress\u8fdb\u884c\u4ea4\u4e92\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5\u548c\u914d\u7f6e<\/strong><\/li>\n<\/ol>\n<p><p>\u8981\u4f7f\u7528<code>python-wordpress-xmlrpc<\/code>\u5e93\uff0c\u4f60\u9700\u8981\u9996\u5148\u5b89\u88c5\u5b83\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install python-wordpress-xmlrpc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u786e\u4fdd\u4f60\u7684WordPress\u7f51\u7ad9\u542f\u7528\u4e86XML-RPC\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWordPress\u542f\u7528\u4e86XML-RPC\uff0c\u4f46\u67d0\u4e9b\u5b89\u5168\u63d2\u4ef6\u53ef\u80fd\u4f1a\u7981\u7528\u5b83\u3002\u56e0\u6b64\uff0c\u8bf7\u786e\u4fdd\u4f60\u7684WordPress\u7f51\u7ad9\u5141\u8bb8XML-RPC\u8bf7\u6c42\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u57fa\u672c\u64cd\u4f5c<\/strong><\/li>\n<\/ol>\n<p><p>\u4e00\u65e6\u5b89\u88c5\u4e86<code>python-wordpress-xmlrpc<\/code>\u5e93\uff0c\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u4e0eWordPress\u8fdb\u884c\u4ea4\u4e92\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u83b7\u53d6\u6587\u7ae0\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from wordpress_xmlrpc import Client, WordPressPost<\/p>\n<p>from wordpress_xmlrpc.methods import posts<\/p>\n<p>client = Client(&#39;https:\/\/example.com\/xmlrpc.php&#39;, &#39;your_username&#39;, &#39;your_password&#39;)<\/p>\n<p>post_list = client.call(posts.GetPosts())<\/p>\n<p>for post in post_list:<\/p>\n<p>    print(post.title)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a<code>Client<\/code>\u5bf9\u8c61\uff0c\u5e76\u4f7f\u7528<code>GetPosts<\/code>\u65b9\u6cd5\u83b7\u53d6\u6587\u7ae0\u5217\u8868\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li><strong>\u521b\u5efa\u548c\u66f4\u65b0\u6587\u7ae0<\/strong><\/li>\n<\/ol>\n<p><p>\u9664\u4e86\u83b7\u53d6\u6587\u7ae0\uff0c\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528<code>python-wordpress-xmlrpc<\/code>\u5e93\u521b\u5efa\u548c\u66f4\u65b0\u6587\u7ae0\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u521b\u5efa\u65b0\u6587\u7ae0\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from wordpress_xmlrpc import Client, WordPressPost<\/p>\n<p>from wordpress_xmlrpc.methods.posts import NewPost<\/p>\n<p>client = Client(&#39;https:\/\/example.com\/xmlrpc.php&#39;, &#39;your_username&#39;, &#39;your_password&#39;)<\/p>\n<p>post = WordPressPost()<\/p>\n<p>post.title = &#39;My New Post&#39;<\/p>\n<p>post.content = &#39;This is the content of my new post.&#39;<\/p>\n<p>post.post_status = &#39;publish&#39;<\/p>\n<p>client.call(NewPost(post))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a<code>WordPressPost<\/code>\u5bf9\u8c61\uff0c\u5e76\u8bbe\u7f6e\u4e86\u6587\u7ae0\u7684\u6807\u9898\u548c\u5185\u5bb9\u3002\u7136\u540e\uff0c\u6211\u4eec\u4f7f\u7528<code>NewPost<\/code>\u65b9\u6cd5\u5c06\u5176\u53d1\u5e03\u5230WordPress\u7f51\u7ad9\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u901a\u8fc7\u7b2c\u4e09\u65b9\u5de5\u5177\u4e0e\u63d2\u4ef6\u6269\u5c55\u529f\u80fd<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u76f4\u63a5\u4f7f\u7528WordPress\u7684API\u548cXML-RPC\uff0c\u4f60\u8fd8\u53ef\u4ee5\u901a\u8fc7\u7b2c\u4e09\u65b9\u5de5\u5177\u548c\u63d2\u4ef6\u6269\u5c55Python\u4e0eWordPress\u7684\u529f\u80fd\u3002\u8fd9\u4e9b\u5de5\u5177\u548c\u63d2\u4ef6\u53ef\u4ee5\u63d0\u4f9b\u989d\u5916\u7684\u529f\u80fd\uff0c\u5982\u6570\u636e\u5206\u6790\u3001\u81ea\u52a8\u5316\u5de5\u4f5c\u6d41\u7a0b\u7b49\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>Zapier\u548cIFTTT<\/strong><\/li>\n<\/ol>\n<p><p>Zapier\u548cIFTTT\u662f\u4e24\u4e2a\u6d41\u884c\u7684\u81ea\u52a8\u5316\u5de5\u5177\uff0c\u5b83\u4eec\u5141\u8bb8\u4f60\u5c06\u4e0d\u540c\u7684\u5e94\u7528\u7a0b\u5e8f\u548c\u670d\u52a1\u8fde\u63a5\u5728\u4e00\u8d77\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u5c06Python\u811a\u672c\u4e0eWordPress\u96c6\u6210\uff0c\u4ece\u800c\u5b9e\u73b0\u81ea\u52a8\u5316\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u8bbe\u7f6e\u4e00\u4e2a\u81ea\u52a8\u5316\u6d41\u7a0b\uff0c\u5f53\u4f60\u5728WordPress\u4e0a\u53d1\u5e03\u65b0\u6587\u7ae0\u65f6\uff0c\u81ea\u52a8\u8fd0\u884c\u4e00\u4e2aPython\u811a\u672c\u6765\u5206\u6790\u6587\u7ae0\u7684\u5185\u5bb9\u5e76\u751f\u6210\u62a5\u544a\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li><strong>WordPress\u63d2\u4ef6<\/strong><\/li>\n<\/ol>\n<p><p>WordPress\u6709\u4e30\u5bcc\u7684\u63d2\u4ef6\u751f\u6001\u7cfb\u7edf\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u63d2\u4ef6\u6765\u589e\u5f3a\u4e0ePython\u7684\u96c6\u6210\u3002\u4f8b\u5982\uff0c\u67d0\u4e9b\u63d2\u4ef6\u53ef\u4ee5\u5c06WordPress\u7684\u6570\u636e\u5bfc\u51fa\u4e3aCSV\u6216JSON\u683c\u5f0f\uff0c\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528Python\u811a\u672c\u8fdb\u884c\u6570\u636e\u5206\u6790\u3002<\/p>\n<\/p>\n<p><p>\u6b64\u5916\uff0c\u8fd8\u6709\u4e00\u4e9b\u63d2\u4ef6\u5141\u8bb8\u4f60\u5728WordPress\u4e2d\u76f4\u63a5\u8fd0\u884cPython\u4ee3\u7801\uff0c\u4ece\u800c\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u7ed3\u5408\u4f7f\u7528WordPress\u7684API\u3001\u7b2c\u4e09\u65b9\u5de5\u5177\u548c\u63d2\u4ef6\uff0c\u4f60\u53ef\u4ee5\u5b9e\u73b0Python\u4e0eWordPress\u7684\u6df1\u5ea6\u96c6\u6210\u3002\u65e0\u8bba\u662f\u81ea\u52a8\u5316\u5de5\u4f5c\u6d41\u7a0b\u3001\u6570\u636e\u5206\u6790\u8fd8\u662f\u5185\u5bb9\u7ba1\u7406\uff0cPython\u90fd\u53ef\u4ee5\u4e3a\u4f60\u7684WordPress\u7f51\u7ad9\u63d0\u4f9b\u5f3a\u5927\u7684\u652f\u6301\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u4e0eWordPress\u8fdb\u884c\u6570\u636e\u4ea4\u4e92\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7WordPress\u63d0\u4f9b\u7684REST API\u4e0ePython\u8fdb\u884c\u6570\u636e\u4ea4\u4e92\u3002\u4f7f\u7528Python\u7684<code>requests<\/code>\u5e93\uff0c\u60a8\u53ef\u4ee5\u53d1\u9001HTTP\u8bf7\u6c42\u6765\u521b\u5efa\u3001\u8bfb\u53d6\u3001\u66f4\u65b0\u6216\u5220\u9664WordPress\u7f51\u7ad9\u4e0a\u7684\u5185\u5bb9\u3002\u786e\u4fdd\u5728\u8c03\u7528API\u4e4b\u524d\uff0c\u60a8\u5df2\u7ecf\u83b7\u53d6\u4e86\u5fc5\u8981\u7684\u8ba4\u8bc1\u4fe1\u606f\u3002<\/p>\n<p><strong>\u5728WordPress\u4e2d\u5982\u4f55\u5b89\u88c5\u652f\u6301Python\u7684\u63d2\u4ef6\uff1f<\/strong><br \/>\u867d\u7136WordPress\u672c\u8eab\u662f\u57fa\u4e8ePHP\u7684\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u5b89\u88c5\u7279\u5b9a\u7684\u63d2\u4ef6\u6765\u589e\u5f3a\u4e0ePython\u7684\u96c6\u6210\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u201cWP REST API\u201d\u63d2\u4ef6\uff0c\u786e\u4fdd\u60a8\u7684\u7f51\u7ad9\u652f\u6301RESTful\u8bf7\u6c42\u3002\u6b64\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u67e5\u627e\u5176\u4ed6\u80fd\u591f\u4e0ePython\u5bf9\u63a5\u7684\u63d2\u4ef6\uff0c\u4ee5\u5b9e\u73b0\u66f4\u591a\u529f\u80fd\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u81ea\u52a8\u53d1\u5e03WordPress\u6587\u7ae0\u7684\u6b65\u9aa4\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u8981\u81ea\u52a8\u53d1\u5e03\u6587\u7ae0\uff0c\u60a8\u9700\u8981\u7f16\u5199Python\u811a\u672c\uff0c\u4f7f\u7528WordPress\u7684REST API\u3002\u9996\u5148\uff0c\u8bbe\u7f6e\u597dAPI\u8ba4\u8bc1\uff08\u5982OAuth\u6216\u5e94\u7528\u7a0b\u5e8f\u5bc6\u7801\uff09\uff0c\u7136\u540e\u4f7f\u7528<code>requests<\/code>\u5e93\u6784\u5efaPOST\u8bf7\u6c42\uff0c\u5305\u542b\u6587\u7ae0\u7684\u6807\u9898\u3001\u5185\u5bb9\u548c\u5176\u4ed6\u5fc5\u8981\u7684\u53c2\u6570\u3002\u6210\u529f\u540e\uff0c\u60a8\u53ef\u4ee5\u5728WordPress\u540e\u53f0\u67e5\u770b\u5230\u65b0\u53d1\u5e03\u7684\u6587\u7ae0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u4e0eWordPress\u96c6\u6210\u7684\u4e3b\u8981\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528WordPress REST API\u4e0ePython\u4ea4\u4e92 [&hellip;]","protected":false},"author":3,"featured_media":936936,"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\/936934"}],"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=936934"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/936934\/revisions"}],"predecessor-version":[{"id":936938,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/936934\/revisions\/936938"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/936936"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=936934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=936934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=936934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}