{"id":4932,"date":"2021-05-31T18:24:37","date_gmt":"2021-05-31T10:24:37","guid":{"rendered":"https:\/\/nj.transwarp.cn:8180\/?p=4932"},"modified":"2022-12-09T11:31:29","modified_gmt":"2022-12-09T03:31:29","slug":"sophon%e4%bd%bf%e7%94%a8gateway%e7%9a%84%e6%96%b9%e5%bc%8f%e4%b8%8a%e7%ba%bfapi","status":"publish","type":"post","link":"https:\/\/kbwp.transwarp.cn\/?p=4932","title":{"rendered":"sophon\u4f7f\u7528gateway\u7684\u65b9\u5f0f\u90e8\u7f72api"},"content":{"rendered":"<h3>\u6982\u8981\u63cf\u8ff0<\/h3>\n<hr \/>\n<p>Sophon\u4e2d\u4e0a\u7ebfapi\u670d\u52a1\u7684\u65b9\u5f0f\u6709nbcovert\u548cgateway\u4e24\u79cd\u3002<br \/>\n\u4ece2.5\u7248\u672c\u5f00\u59cb\uff0cpython3\/octave\u7684kernel\u5bf9\u5e94\u7684\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u652f\u6301gateway\u65b9\u5f0f\u90e8\u7f72\u6210api\uff0c\u8be5\u6a21\u5f0f\u8981\u6c42\u7528\u6237\u9075\u5faa\u4e00\u5b9a\u7684\u89c4\u5219\u5b8c\u6210\u4ee3\u7801\u6587\u4ef6\u7684\u7f16\u5199\uff0c\u652f\u6301\u591a\u7ebf\u7a0b\u53d1\u5e03\uff0c\u54cd\u5e94\u901f\u5ea6\u5feb\uff0c\u9002\u7528\u4e8e\u5bf9\u6027\u80fd\u6709\u8981\u6c42\u7684\u90e8\u7f72\u4efb\u52a1\u3002<\/p>\n<p>\u672c\u7bc7\u6587\u7ae0\u4e3b\u8981\u8bb2\u8ff0\u4f7f\u7528gateway\u7684\u65b9\u5f0f\u90e8\u7f72api\u3002<\/p>\n<h3>\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<h4>gateway\u670d\u52a1\u7684\u903b\u8f91<\/h4>\n<p>\u6253\u5f00notebook\uff0c\u6bcf\u4e2acell\u53ef\u4ee5\u89c6\u4e3a\u4e00\u4e2a\u5b8c\u6574api\u8bf7\u6c42\u7684\u6574\u4f53\uff0c\u7b2c\u4e00\u884c\u4ee5\u201c#\u201d\u5f00\u5934\uff0c\u7a7a\u683c\u518d\u52a0api\u7c7b\u578b\uff0c\u7a7a\u683c\u52a0api\u8bf7\u6c42\u540d\u79f0\uff0c\u5b9a\u4e49\u4e86\u4e00\u4e2aapi\u8bf7\u6c42\uff0c\u540e\u7eed\u7684\u5185\u5bb9\u4e3a\u670d\u52a1\u7aef\u6536\u5230\u8bf7\u6c42\u540e\u6240\u6267\u884c\u7684\u5185\u5bb9\u3002\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u7684\u4fe1\u606f\u90fd\u662fprint\u4e2d\u7684\u5185\u5bb9\u3002 <\/p>\n<p><strong>\u56e0\u4e3a\u670d\u52a1\u53d1\u5e03\u5728\u5bb9\u5668\u4e2d\uff0c\u9700\u8981\u786e\u8ba4\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\uff0c\u56e0\u6b64\u5fc5\u987b\u5efa\u7acb\/api\/ping\u7684GET\u8bf7\u6c42\uff0c\u8fd4\u56de'{&quot;status&quot;:&quot;running&quot;}&#8217;\uff0c\u4f5c\u4e3a\u670d\u52a1\u7684\u5065\u5eb7\u6307\u6807\u3002<\/strong><\/p>\n<p><font color=\"red\"> <strong>\u6ce8\u610f\uff1a\u4ee5\u4e0b\u8fd9\u4e24\u4e2acell \u662f\u5fc5\u987b\u5b58\u5728\u7684\uff01\uff01\uff01<\/strong><\/font> <\/p>\n<pre><code class=\"language-python\">import json<\/code><\/pre>\n<pre><code class=\"language-python\"># GET \/api\/ping\na = {\"status\":\"running\"}\nprint(json.dumps(a))<\/code><\/pre>\n<h4>GET\u8bf7\u6c42\u793a\u4f8b<\/h4>\n<p>\u901a\u8fc7notebook\u6253\u5f00\u4e00\u4e2apython3\u7684kernel\uff0c\u65b0\u5efa\u6587\u4ef6\uff0c\u5c06\u4e0b\u8ff0\u4ee3\u7801\u653e\u5728\u540c\u4e00\u4e2acell\u4e2d \uff1a<\/p>\n<pre><code class=\"language-python\"># GET \/hello\nprint(\"hello world!\")<\/code><\/pre>\n<p>\u7b2c\u4e00\u884c\u5b9a\u4e49\u4e86\u540d\u4e3a\u201chello\u201d\u7684GET\u8bf7\u6c42\uff0c\u6267\u884c\u7684\u5185\u5bb9\u53ea\u6709\u4e00\u884cprint\u8bed\u53e5\uff0c\u8fd4\u56de\u7684\u503c\u5373print\u4e2d\u7684\u5185\u5bb9\u3002 <\/p>\n<p>\u5982\u679c\u6587\u4ef6\u4e2d\u518d\u65b0\u589e\u4e00\u4e2acell\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a <\/p>\n<pre><code class=\"language-python\"># GET \/hello2\na = 1+2+3+4\nprint(\"hello world!\", a)<\/code><\/pre>\n<p>\u4e00\u4e2aipynb\u6587\u4ef6\u53ef\u80fd\u4f1a\u6709\u591a\u4e2acell\uff0c\u670d\u52a1\u542f\u52a8\u65f6\u4f1a\u4f9d\u6b21\u4ece\u5934\u81f3\u5c3e\u6267\u884c\u6bcf\u4e2acell\u5185\u5bb9\uff0c\u5f53\u6536\u5230\u76f8\u5e94\u7684\u8bf7\u6c42\u65f6\uff0c\u670d\u52a1\u53ea\u4f1a\u518d\u6b21\u6267\u884c\u5bf9\u5e94\u8bf7\u6c42\u7684cell\u4e2d\u7684\u5185\u5bb9\uff0c\u901a\u8fc7\u8fd9\u6837\u7684\u65b9\u5f0f\u63d0\u5347\u4e86\u6027\u80fd\u3002\u4e3e\u4f8b\u5982\u4e0b\uff1a <\/p>\n<pre><code class=\"language-python\">sum=0\nfor i in range(1,5,1):\n    for j in range(1,5,1):\n        for k in range(1,5,1):\n            if(i!=j&j!=k):\n                sum=sum+1;<\/code><\/pre>\n<pre><code class=\"language-python\"># GET \/sum\nprint(\"sum is :\",sum)<\/code><\/pre>\n<p>\u5f53\u670d\u52a1\u521d\u59cb\u5316\u65f6\uff0c\u5c31\u5df2\u7ecf\u8ba1\u7b97\u4e86sum\u7684\u503c\uff0c\u5f53\u7528\u6237\u53d1\u8d77\/sum\u7684\u8bf7\u6c42\u65f6\uff0c\u76f4\u63a5\u8fd4\u56desum\u7684\u8ba1\u7b97\u503c36\u5373\u53ef\u3002 <\/p>\n<h4>POST \u8bf7\u6c42\u793a\u4f8b<\/h4>\n<p>\u5f53\u6211\u4eec\u53d1\u8d77\u8bf7\u6c42\u4e2d<strong>\u5e26\u6709\u7ed3\u6784\u4f53\u6570\u636e<\/strong>\u65f6\uff0c\u5e94\u5f53\u4f7f\u7528POST\u8bf7\u6c42\uff0c\u4e0b\u9762\u7ed9\u51fa\u7b80\u5355\u6837\u4f8b\uff0c\u540c\u6837\u7684\uff0c\u8fd94\u884c\u4ee3\u7801\u9700\u8981\u5199\u5728\u540c\u4e00\u4e2acell\u91cc <\/p>\n<pre><code class=\"language-python\"># POST \/num\nreq = json.loads(REQUEST)\nargs = req['body']\nnum = args['num']\nprint(num)<\/code><\/pre>\n<p><strong>\u89e3\u91ca<\/strong><\/p>\n<ul>\n<li>\u7b2c\u4e00\u884c\u5b9a\u4e49\u4e86\u540d\u4e3a&quot;num&quot;\u7684POST\u8bf7\u6c42\u3002<\/li>\n<li>\u7b2c\u4e8c\u884c\u7684<strong>REQUEST\u4e0d\u9700\u8981\u5b9a\u4e49<\/strong>\uff0c\u901a\u8fc7json.loads\u83b7\u5f97\u6574\u4e2a\u4f20\u5165request\u7684\u4fe1\u606f\uff0c\u5176\u4e2d&quot;body&quot;\u5bf9\u8c61\u5373\u7528\u6237\u4f20\u5165\u7684\u7ed3\u6784\u4f53\u4fe1\u606f\u3002<strong>\u6ce8\u610f<\/strong>\uff1a\u8fd9\u91cc\u4f7f\u7528\u4e86json\u65b9\u6cd5\uff0c\u9700\u8981\u5728\u8fd9\u4e2acell\u4e4b\u524d\u7684cell\u91cc\u6267\u884c\u201cimport json\u201d\u3002<\/li>\n<li>\u7b2c\u56db\u884c\u4eceargs\u91cc\u53d6\u51fa&quot;num&quot;\u5bf9\u8c61\u7684\u503c\uff0c\u7b2c\u4e94\u884c\u4e88\u4ee5\u8fd4\u56de\u3002<\/li>\n<\/ul>\n<p><strong>notebook\u4ee3\u7801\u4e2d\u8fd0\u884c\u65f6\u4f1a\u62a5\u9519<\/strong>\uff1a <\/p>\n<pre><code class=\"language-python\">NameError: name 'REQUEST' is not defined<\/code><\/pre>\n<p>\u76f4\u63a5\u5ffd\u7565\u5373\u53ef\uff0c \u5728\u90e8\u7f72\u65f6\u4e0d\u4f1a\u62a5\u9519\u3002<\/p>\n<h4>\u4e0a\u67b6\u6a21\u578b<\/h4>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609319674335.png\" alt=\"file\" \/><\/p>\n<p>\u65b0\u5efa\u6a21\u578b\u6210\u529f\u540e\uff0c\u70b9\u8fdb<strong>\u7248\u672c\u7ba1\u7406<\/strong>\uff0c \u4e0a\u67b6\u6a21\u578b\u670d\u52a1\u7248\u672c<\/p>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609319750229.png\" alt=\"file\" \/><br \/>\n<img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609319779871.png\" alt=\"file\" \/><\/p>\n<p>gateway\u65b9\u5f0f\uff0c\u63a5\u53e3\u8bbe\u7f6e\u9875\u9762\u4ec5\u505a\u5c55\u793a\u7528\uff0c\u4f9b\u7528\u6237\u786e\u8ba4\u4ee3\u7801\u65e0\u8bef\u3002 <\/p>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609319821366.png\" alt=\"file\" \/><\/p>\n<p>\u70b9\u51fb\u3010\u4e0a\u67b6\u3011\u5373\u53ef\u5b8c\u6210\u4ee3\u7801\u6a21\u578b\u7684\u4e0a\u67b6\u64cd\u4f5c <\/p>\n<p><strong>\u6ce8\u610f<\/strong><\/p>\n<p>1.\u7528\u6237\u57fa\u4e8epython3\u7684\u955c\u50cf\u521b\u5efa\u5b9e\u4f8b\uff0c\u5b8c\u6210\u4ee3\u7801\u5e76\u6210\u529f\u6267\u884c\uff0c\u8fc7\u7a0b\u4e2d\u4e0d\u9700\u8981\u5b89\u88c5\u65b0\u7684\u4f9d\u8d56\uff0c\u90a3\u4e48\u521b\u5efaapi\u4efb\u52a1\u65f6\uff0c\u9009\u62e9python3\u7684\u955c\u50cf\uff0c\u4e0e\u672c\u6b21\u5b8c\u6210\u7684\u4ee3\u7801\uff0c\u8fdb\u884c\u90e8\u7f72\u3002<br \/>\n2.\u7528\u6237\u57fa\u4e8epython3\u7684\u955c\u50cf\u521b\u5efa\u5b9e\u4f8b\uff0c\u540c\u65f6<strong>\u5b89\u88c5\u4e86\u5f53\u524d\u73af\u5883\u6ca1\u6709\u7684python\u5305<\/strong>\uff0c\u5b8c\u6210\u4ee3\u7801\u5e76\u6210\u529f\u6267\u884c\uff0c\u4ee3\u7801\u4e2d\u4f9d\u8d56\u65b0\u5b89\u88c5\u7684python\u5305\uff1b\u90a3\u4e48\u9700\u8981<strong>\u5148\u5c06\u8be5\u5b9e\u4f8b\u56fa\u5316\u6210\u65b0\u7684\u955c\u50cf<\/strong>\uff0c\u53ef\u547d\u540d\u4e3atest1\uff1b\u540e\u7eed\u521b\u5efaapi\u4efb\u52a1\u65f6\uff0c<strong>\u9009\u62e9test1\u7684\u955c\u50cf\u5e76\u9009\u62e9\u4f9d\u8d56\u7b2c\u4e09\u65b9lib\u5305<\/strong>\u4e0e\u672c\u6b21\u7684\u4ee3\u7801\u8fdb\u884c\u90e8\u7f72,<br \/>\n<code>sophon\u529f\u80fdspark\u955c\u50cf\u4e0d\u652f\u6301\u4f5c\u4e3aapi\u53d1\u5e03\u7684\u57fa\u7840\u955c\u50cf\uff0c\u56e0\u6b64\uff0c\u5982\u679c\u4e00\u4e2a\u811a\u672c\u53ea\u80fd\u5728\u8be5\u955c\u50cf\u4e2d\u6267\u884c\u6210\u529f\uff0c\u90a3\u4e48\u4e5f\u4e0d\u652f\u6301\u5c06\u5176\u53d1\u5e03\u4e3aapi\u3002 <\/code><br \/>\n3.\u7236\u6587\u4ef6\uff1a\u9700\u8981\u4f9d\u8d56\u7684\u6587\u4ef6\u548c\u4ee3\u7801\u5728notebook\u653e\u5230\u4e00\u4e2a\u6587\u4ef6\u5939\u91cc\u9762\uff0c\u4e0a\u67b6\u7684\u65f6\u5019\u9009\u62e9\u4f9d\u8d56\u7236\u6587\u4ef6\uff0c\u5c31\u4f1a\u628a\u4ee3\u7801\u6240\u5728\u7684\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6\u90fd\u653e\u5230\u955c\u50cf\u91cc\u9762\uff0c \u4ee3\u7801\u91cc\u9762\u5f15\u7528\u4f7f\u7528<strong>\u76f8\u5bf9\u8def\u5f84<\/strong>\uff0c\u4f8b\u5982\u4ee3\u7801\u548c\u5f15\u7528\u7684\u7236\u6587\u4ef6<code>hello.txt<\/code>\u90fd\u653e\u5728test\u76ee\u5f55\u4e0b\uff0c\u4ee3\u7801\u4e2d\u8def\u5f84\u76f4\u63a5\u5199\u5f15\u7528\u7684\u6587\u4ef6\u5c31\u53ef\u4ee5\uff0c \u4e0d\u9700\u8981\u52a0\u8def\u5f84\u3002\u7236\u6587\u4ef6\u4e0d\u5b9c\u8fc7\u5927\uff0c\u5426\u5219\u4f1a\u8d85\u65f6\u3002<\/p>\n<p><strong>\u4e0a\u7ebf<\/strong><\/p>\n<p>\u4e0a\u7ebf\u7684 \u8be6\u7ec6\u6b65\u9aa4\u67e5\u770b\u6559\u7a0b\u6587\u6863\u7684 <strong>\u670d\u52a1\u7ba1\u7406<\/strong> \u7ae0\u8282\uff0c<\/p>\n<p><font color=\"red\"> <strong>\u9700\u8981\u786e\u4fdd \u8fde\u63a5\u72b6\u6001 \u548c \u8fde\u63a5\u72b6\u6001 \u90fd\u662f\u6210\u529f\u7684\u3002<\/strong><\/font><\/p>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609319872485.png\" alt=\"file\" \/><\/p>\n<h4>\u6d4b\u8bd5\u7ed3\u679c<\/h4>\n<h5>\u4f7f\u7528sophon\u7684\u6d4b\u8bd5\u9875\u9762<\/h5>\n<p>\u5728sophon\u4e2d\u4f7f\u7528\u6d4b\u8bd5\u529f\u80fd\u65f6\uff0c<strong>\u8bf7\u4f7f\u7528POST\u8bf7\u6c42<\/strong>\uff0c\u5e76\u5c06\u4f20\u5165\u53c2\u6570\u6309json\u7ed3\u6784\u5904\u7406\uff0c\u5728\u4e0a\u8ff0num\u65b9\u6cd5\u6848\u4f8b\u4e2d\u7684args\u5373\u4f20\u5165\u53c2\u6570\uff0c\u4f20\u5165\u65f6\u9700\u662fjson\u7ed3\u6784\uff0c\u670d\u52a1\u6587\u4ef6\u7f16\u5199\u8fc7\u7a0b\u4e2d\u4e5f\u9700\u8981\u6309json\u7ed3\u6784\u4eceargs\u91cc\u8bfb\u53d6\u4fe1\u606f\u3002<\/p>\n<p><strong>\u6d4b\u8bd5\u9875\u9762\u53ea\u80fd\u6d4b\u8bd5post \u8bf7\u6c42<\/strong><\/p>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609319904602.png\" alt=\"file\" \/><\/p>\n<p><strong>&#8211; api\u63a5\u53e3\u662f\u4e0a\u7ebf\u7684\u65f6\u5019\u5b9a\u4e49\u7684\u540d\u5b57\uff1a <a href=\"http:\/\/jiujiu-tdh-70:8003\/{\u4e0a\u7ebf\u65f6\u81ea\u5b9a\u4e49\u7684\u540d\u5b57\">http:\/\/jiujiu-tdh-70:8003\/{\u4e0a\u7ebf\u65f6\u81ea\u5b9a\u4e49\u7684\u540d\u5b57<\/a>}<\/strong><\/p>\n<p><strong>&#8211; \u9700\u8981\u5728API\u63a5\u53e3\u540e\u9762\u52a0\u4e0a\u4ee3\u7801\u4e2d\u5b9a\u4e49\u7684\u8bf7\u6c42\u540d\uff0c\u4f8b\u5982\u4ee3\u7801\u4e2d\u5b9a\u4e49\u7684post\u8bf7\u6c42\u540d\u4e3a\/num\uff0c \u5373\u6539\u6210 <a href=\"http:\/\/jiujiu-tdh-70:8003\/gatewaytestv1\/num\">http:\/\/jiujiu-tdh-70:8003\/gatewaytestv1\/num<\/a><\/strong><\/p>\n<h5>\u7f51\u9875\u6253\u5f00URL \u5c06get\u8bf7\u6c42\u8fd4\u56de\u7ed3\u679c<\/h5>\n<p><strong>api\u63a5\u53e3\u540e\u9762\u9700\u8981\u52a0\u4e0a\u4ee3\u7801\u4e2d\u5b9a\u4e49\u7684\u8bf7\u6c42\u540d<\/strong><\/p>\n<p>\u793a\u4f8b\u4e2d\uff1a<\/p>\n<ul>\n<li>\u4e0a\u7ebf\u65f6\u7684api\u63a5\u53e3\uff1a <a href=\"http:\/\/jiujiu-tdh-70:8003\/gatewaytestv1\">http:\/\/jiujiu-tdh-70:8003\/gatewaytestv1<\/a><\/li>\n<li>\u4ee3\u7801\u4e2d\u5b9a\u4e49\u7684\u8bf7\u6c42\uff1a\/hello \u3001\/hello2<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609319932423.png\" alt=\"file\" \/><\/p>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609319947708.png\" alt=\"file\" \/><\/p>\n<h5>\u4f7f\u7528curl\u8fd4\u56de\u7ed3\u679c<\/h5>\n<h6>\u4e00\u3001\u4f7f\u7528\u6d4b\u8bd5\u9875\u9762\u7684ip\u548c\u7aef\u53e3<\/h6>\n<p><strong>post\u8bf7\u6c42<\/strong><br \/>\n\u53ef\u4ee5\u76f4\u63a5\u590d\u5236\u6d4b\u8bd5\u754c\u9762\u7684\u8c03\u7528\u793a\u4f8b\uff0c\u5728\u547d\u4ee4\u884c\u6267\u884c<\/p>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609319976247.png\" alt=\"file\" \/><\/p>\n<pre><code class=\"language-shell\">[root@jiujiu-tdh-71 ~]# curl -k -X POST http:\/\/jiujiu-tdh-70:8003\/gatewaytestv1\/num -H \"Content-type: application\/json\" -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6Inp5cSIsInJvbGVzIjoiW1wiU09QSE9OX0FETUlOXCIsXCJwdWJsaWNcIixcImFkbWluXCJdIiwiZXhwIjo0NzYyOTQ0NTQ3LCJpYXQiOjE2MDkzNDQ1NDd9.Mj71LW0gsjGLhzdiDQuTIZY6fQf9ZXK1r26TwXBQFInuIwuWz1BfuX23eRudimIAszoYDV9jbkkbagScY_vyQA' -d '{\"num\":4}'\n4\n[root@jiujiu-tdh-71 ~]#\n<\/code><\/pre>\n<p><strong>get\u8bf7\u6c42<\/strong><\/p>\n<pre><code class=\"language-shell\">[root@jiujiu-tdh-71 ~]# curl  http:\/\/jiujiu-tdh-70:8003\/gatewaytestv1\/hello\nhello world!\n[root@jiujiu-tdh-71 ~]#<\/code><\/pre>\n<h6>\u4e8c\u3001\u4f7f\u7528pod\u7684ip\u548csvc\u7684\u7aef\u53e3<\/h6>\n<ol>\n<li>\u83b7\u53d6\u90e8\u7f72\u7684\u670d\u52a1\u7684\u793a\u4f8b\u540d\u79f0<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609320335950.png\" alt=\"file\" \/><\/p>\n<p><img decoding=\"async\" src=\"..\/wp-content\/uploads\/2020\/12\/image-1609320361435.png\" alt=\"file\" \/><\/p>\n<ol start=\"2\">\n<li>\u590d\u5236\u524d\u9762\u90e8\u5206\u83b7\u53d6svc\u7684ip\u548cport<\/li>\n<\/ol>\n<pre><code class=\"language-shell\">[root@jiujiu-tdh-71 ~]# kubectl get svc -owide|grep deploy-8ddc7ae3-085f-4431\ndeploy-8ddc7ae3-085f-4431-a29c-bc9b0eeebcfc   ClusterIP   10.10.10.216   <none>        45907\/TCP                                                     39m       aip.kube.app.general.deploy=7761f941-cda5-43ff-9264-096e81f485c6,aip.kube.app.name=deploy-8ddc7ae3-085f-4431-a29c-bc9b0eeebcfc,aip.kube.app.service=000d4fe7-1e26-4e17-8753-c6523f10560e\n[root@jiujiu-tdh-71 ~]#<\/code><\/pre>\n<ol start=\"3\">\n<li>\u5728\u547d\u4ee4\u884c\u6267\u884ccurl\u547d\u4ee4\uff0c ip\u548cport \u5728\u4e0a\u4e24\u6b65\u83b7\u53d6\uff0c\u52a0\u4e0a\u5bf9\u5e94\u7684\u8bf7\u6c42\u548c\u4f20\u53c2\uff08\u4f20\u53c2\u53ef\u9009\u9879\uff09<\/li>\n<\/ol>\n<p><strong>GET\u8bf7\u6c42<\/strong><\/p>\n<pre><code class=\"language-shell\">[root@jiujiu-tdh-71 ~]# curl http:\/\/10.10.10.216:45907\/hello\nhello world!\n[root@jiujiu-tdh-71 ~]#<\/code><\/pre>\n<pre><code class=\"language-shell\">[root@jiujiu-tdh-71 ~]# curl http:\/\/10.10.10.216:45907\/hello2\nhello world! 10\n[root@jiujiu-tdh-71 ~]#\n<\/code><\/pre>\n<p><strong>POST\u8bf7\u6c42<\/strong><\/p>\n<pre><code class=\"language-shell\">[root@jiujiu-tdh-71 ~]# curl -k -X POST http:\/\/10.10.10.216:45907\/num -H \"Content-type: application\/json\" -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6Inp5cSIsInJvbGVzIjoiW1wiU09QSE9OX0FETUlOXCIsXCJwdWJsaWNcIixcImFkbWluXCJdIiwiZXhwIjo0NzYyOTQ0NTQ3LCJpYXQiOjE2MDkzNDQ1NDd9.Mj71LW0gsjGLhzdiDQuTIZY6fQf9ZXK1r26TwXBQFInuIwuWz1BfuX23eRudimIAszoYDV9jbkkbagScY_vyQA' -d '{\"num\":4}'\n4\n[root@jiujiu-tdh-71 ~]#<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981\u63cf\u8ff0 Sophon\u4e2d\u4e0a\u7ebfapi\u670d\u52a1\u7684\u65b9\u5f0f\u6709nbcovert\u548cgateway\u4e24\u79cd\u3002 \u4ece2.5\u7248\u672c\u5f00\u59cb\uff0cpyt ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/kbwp.transwarp.cn\/?p=4932\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4932","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"_links":{"self":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/4932","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4932"}],"version-history":[{"count":2,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/4932\/revisions"}],"predecessor-version":[{"id":4945,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/4932\/revisions\/4945"}],"wp:attachment":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}