{"id":261795,"date":"2015-07-19T01:42:01","date_gmt":"2015-07-18T21:42:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=261795"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=261795","title":{"rendered":"\u041b\u0438\u0447\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 Wolfram Language"},"content":{"rendered":"<p>     \t\u0418\u043d\u043e\u0433\u0434\u0430 \u043b\u044e\u0434\u044f\u043c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0440\u043d\u0435\u0432\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 Wolfram Language. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0438 \u0434\u043e\u043b\u0433\u0438\u0439 \u043f\u0443\u0442\u044c. \u041d\u0430\u0433\u0440\u0430\u0434\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u0440\u0430\u0441\u043e\u0442\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0418 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u0442\u044c, \u0438\u043c\u0435\u043d\u0438 \u0445\u043b\u0435\u0431\u0430 \u0438 \u0442\u0440\u043e\u043b\u043b\u0435\u0439\u0431\u0443\u0441\u0430, \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439 \u0438 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u043e\u0432. \u041e \u043d\u0435\u043c \u043c\u044b \u0438 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u042f \u043d\u0430\u0447\u0430\u043b \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c Mathematica \u0438 Wolfram Language \u0433\u0434\u0435-\u0442\u043e \u043f\u043e\u043b\u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u201c\u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0439\u201d \u044f\u0437\u044b\u043a \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u044b\u0442\u043e\u0432\u044b\u0445 \u0438 \u043e\u043a\u043e\u043b\u043e\u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u0417\u043d\u0430\u0435\u0442\u0435, \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0443\u043c, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e, \u0441\u043a\u0430\u0436\u0435\u043c, \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0441\u0442\u0435\u043c. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0440\u043e\u043b\u0438 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u043b Python, \u043d\u043e \u0442\u0443\u0442 \u0443 \u043d\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0439 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0432\u0441\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0431\u043b\u043e\u043a\u043d\u043e\u0442 Mathematica \u0438 \u0440\u0430\u0437\u043e\u0432\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u0434 \u0438\u0437 \u043d\u0435\u0433\u043e. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043b\u0438\u0431\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044e. \u041d\u0443\u0436\u0435\u043d \u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 <a href=\"http:\/\/www.wolfram.com\/universal-deployment-system\/\">\u0441\u0430\u043c\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f<\/a>. \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u043c\u043e\u0433\u0443 \u0441\u0443\u0434\u0438\u0442\u044c, \u043e\u043f\u0446\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<br \/>  1) \u0421\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 Mathematica Notebook. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0440\u0430\u0437\u043e\u0432\u0430\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0441\u0435\u0441\u0441\u0438\u044f \u0432 GUI.<br \/>  2) <a href=\"http:\/\/www.wolfram.com\/cloud\/\">Wolfram Cloud<\/a>. \u0418 \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0430 \u043f\u0440\u0438\u0447\u0438\u043d, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u043e\u0431\u043b\u0430\u043a\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0442\u0438. \u041d\u0430\u0437\u043e\u0432\u0443 \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0443 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0441\u0442\u043e\u0438\u0442 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u043d\u0435\u0433. \u0414\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043c\u0435\u043b\u043a\u0438\u0445 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438.<br \/>  3) Wolfram Private Cloud. \u0417\u0432\u0443\u0447\u0438\u0442 \u043a\u0430\u043a \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0433\u0440\u044f\u0434\u0443\u0449\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u043b\u0430\u043a\u043e. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b<br \/>  4) \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/reference.wolfram.com\/language\/tutorial\/IntroductionToWSTP.html\">Wolfram Symbolic Transfer Protocol<\/a>. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0441\u0430\u043c\u044b\u0439 \u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 Wolfram Language \u0432 \u0432\u0430\u0448\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u0421\u0435\u0440\u0432\u0435\u0440 \u0437\u0434\u0435\u0441\u044c \u2014 \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0422\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u201c\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0438 \u0434\u043e\u043b\u0433\u0438\u0439 \u043f\u0443\u0442\u044c\u201d.<br \/>  5) <a href=\"http:\/\/reference.wolfram.com\/language\/tutorial\/WolframLanguageScripts.html\">Wolfram Script<\/a>. \u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 Wolfram Language \u043a\u0430\u043a \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u0431\u0435\u0437 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. Cron, pipeline \u0438 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0432 \u043d\u0430\u0448\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438. \u042d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0417\u043d\u0430\u0439 \u0441\u0435\u0431\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u043e HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  \u041d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e, \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e Tornado. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 handler, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<pre><code class=\"python\">class MainHandler(tornado.web.RequestHandler):     def get(self):                      out = execute([WOLFRAM_EXECUTABLE,&quot;-script&quot;, &quot;server\/main.m&quot;,                                           str(self.request.method),                                           str(json.dumps(self.request.arguments)),                                           str(json.dumps(self.request.headers)),                                           str(self.request.body)]                                           )             self.write(out) <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u201cserver\/main.m\u201d \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 Wolfram Language. \u0412 \u043d\u0435\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. <\/p>\n<pre><code>method =     $CommandLine[[4]]  arguments =     Association @ ImportString[$CommandLine[[5]], &quot;JSON&quot;]  headers =     Association @ ImportString[$CommandLine[[6]], &quot;JSON&quot;]  body =     If[Length[$CommandLine] &gt;= 7,$CommandLine[[7]], &quot;&quot;]  Print[\u201cHello world&quot;] <\/code><\/pre>\n<p>  \u041d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u201cHello world\u201d. \u041d\u0435 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u043c\u0443 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u043f\u0440\u0438\u043c\u0435\u0440. \u0427\u0430\u0441\u0442\u044c \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0447\u0435\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<br \/>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0432 \u044d\u0442\u043e\u043c \u0432\u0441\u044f \u0441\u0443\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430. \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 JSON \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. <\/p>\n<p>  \u0412 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 200. \u0425\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0430 \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435. \u0422\u0430\u043a \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 JSON \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0424\u043e\u0440\u043c\u0430\u0442 \u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c:<\/p>\n<pre><code class=\"javascript\">{      \u201ccode\u201d: 200,      \u201creason\u201d: OK,      \u201cbody\u201d: \u201cHello world&quot; } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435. <\/p>\n<pre><code class=\"python\">outJson =  json.loads(out)         self.set_status(outJson[&quot;code&quot;], outJson[&quot;reason&quot;])         if(outJson[&quot;body&quot;] != None):             self.write(str(outJson[&quot;body&quot;])) <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0441\u0442, \u043d\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0432\u0430 \u0434\u0432\u043e\u0439\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f JSON \u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043a\u043e\u043c\u0443-\u0442\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c\u2026 \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0448 JSON \u043f\u043e\u043b\u044f \u201cfile\u201d \u0438 \u201ccontentType&quot;. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 \u201cfile&quot; \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0435, \u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u201cbody\u201d \u043c\u044b \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">outJson =  json.loads(out)         self.set_status(outJson[&quot;code&quot;], outJson[&quot;reason&quot;])         if(outJson[&quot;file&quot;] != None):             self.add_header(&quot;Content-Type&quot;, outJson[&quot;contentType&quot;])             with open(outJson[&quot;file&quot;], 'rb') as f:                 while True:                     data = f.read(16384)                     if not data: break                     self.write(data)             self.finish()             os.remove(outJson[&quot;file&quot;])         elif(outJson[&quot;body&quot;] != None):             self.write(str(outJson[&quot;body&quot;])) <\/code><\/pre>\n<p>  \u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u044d\u0442\u043e \u0432\u0441\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u041f\u0430\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u0432\u0435\u0442\u0430:<\/p>\n<pre><code>AsJson[input_] := ExportString[Normal @ input, &quot;JSON&quot;]  HTTPOut[code_, body_, reason_] :=     &lt;|&quot;code&quot;-&gt;code, &quot;body&quot;-&gt;body, &quot;reason&quot;-&gt;reason, &quot;file&quot;-&gt;Null|&gt;  HTTPOut[body_] :=     HTTPOut[200, body, Null]  HTTPOutFile[expression_, exportType_, contentType_] :=      Module[{filePath = FileNameJoin[{$TemporaryDirectory, &quot;httpOutFile&quot;}]},     Export[filePath, expression, exportType];     &lt;|&quot;code&quot;-&gt;200,      &quot;body&quot;-&gt;Null,      &quot;reason&quot;-&gt;Null,      &quot;file&quot;-&gt;filePath,      &quot;contentType&quot;-&gt;contentType|&gt; ] <\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<pre><code>HTTPGet[arguments_, headers_] := AsJson[...]  Switch[method,      &quot;GET&quot;, HTTPGet[arguments, headers],      &quot;POST&quot;, HTTPPost[arguments, headers, body]] <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u044b HTTPGet, HTTPost \u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0443\u0442\u0435\u0439 (\u201c\/\u201c, \u201c\/SomeEndpoint\u201d \u0438 \u0442.\u0434.), \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u0432\u044b\u0437\u043e\u0432\u0443 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e: \u201c\/?op=MyFunction\u201d.<br \/>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u044b\u0431\u043e\u0440\u0430 \u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435. \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 Switch \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0442\u043e\u043d\u044c\u0448\u0435. \u0418\u043c \u0431\u0443\u0434\u0435\u0442 <a href=\"http:\/\/reference.wolfram.com\/language\/ref\/ToExpression.html?q=ToExpression\">ToExpression[]<\/a>.<\/p>\n<pre><code>HTTPGet[arguments_, headers_] :=     Module[{methodName = &quot;GET&quot;&lt;&gt;arguments[&quot;op&quot;]},        AsJson[ToExpression[methodName][arguments, headers]]    ] <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e GETMyFuction \u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0433\u043e\u0442\u043e\u0432\u0430. \u041f\u0443\u0441\u0442\u044c \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f:<\/p>\n<pre><code>GETMyFuction[arguments_, headers_] :=     HTTPOut[ToString[Now]] <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438. \u0418 \u0440\u0430\u0437 \u0443\u0436 \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u0438\u0445 \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u043c <a href=\"http:\/\/reference.wolfram.com\/language\/guide\/Patterns.html\">\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u044e\u0431\u043e\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<pre><code>GETTestGraph[___] :=     Module[{},       out = Graph[{a -&gt; e, a -&gt; c, b -&gt; c, a -&gt; d, b-&gt;d, c-&gt;a}];       HTTPOutFile[out, &quot;PNG&quot;, &quot;image\/png&quot;]    ] <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u201c&#8230;\/?op=TestGraph\u201d \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/hsto.org\/files\/c09\/f5f\/2c6\/c09f5f2c66f44e2199546ed6c12a7081.png\" alt=\"image\"\/><\/p>\n<p>  Wolfram Language \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0435\u0449\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0441 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b PUTSourceFile \u0438 DELETESourceFile, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c API \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0435\u0433\u043e \u0436\u0435 (\u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f). \u042d\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0430\u043d\u0430\u043b\u043e\u0433\u0430 CloudDeploy, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0441 \u043d\u0430\u0448\u0438\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043d\u0435\u0441\u043f\u0435\u0448\u043d\u044b\u043c \u043b\u0438\u0447\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451 \u0438 \u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0434\u043d\u044f!     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/262983\/\"> http:\/\/habrahabr.ru\/post\/262983\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u0418\u043d\u043e\u0433\u0434\u0430 \u043b\u044e\u0434\u044f\u043c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0440\u043d\u0435\u0432\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 Wolfram Language. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0438 \u0434\u043e\u043b\u0433\u0438\u0439 \u043f\u0443\u0442\u044c. \u041d\u0430\u0433\u0440\u0430\u0434\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u0440\u0430\u0441\u043e\u0442\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0418 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u0442\u044c, \u0438\u043c\u0435\u043d\u0438 \u0445\u043b\u0435\u0431\u0430 \u0438 \u0442\u0440\u043e\u043b\u043b\u0435\u0439\u0431\u0443\u0441\u0430, \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439 \u0438 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u043e\u0432. \u041e \u043d\u0435\u043c \u043c\u044b \u0438 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-261795","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/261795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=261795"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/261795\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=261795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=261795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=261795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}