{"id":279751,"date":"2016-05-07T18:45:02","date_gmt":"2016-05-07T14:45:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=279751"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=279751","title":{"rendered":"\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API \u0441\u0430\u0439\u0442\u0430, \u043a\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u043d\u0435\u0442"},"content":{"rendered":"\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API \u0441\u0430\u0439\u0442\u0430, \u0435\u0441\u043b\u0438 \u043f\u043e \u043d\u0435\u043c\u0443 \u043d\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u043e\u043d\u043e \u0435\u0449\u0435 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e. \u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u0437\u0430\u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API. \u0414\u043b\u044f \u0442\u0435\u0445 \u0436\u0435 \u043a\u0442\u043e \u0441\u0430\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442. <\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0431\u043e\u0440 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 API \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <a href=\"https:\/\/www.captionbot.ai\/\">https:\/\/www.captionbot.ai\/<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u043b Microsoft (\u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0438\u043c \u0437\u0430 \u044d\u0442\u043e). \u041c\u043d\u043e\u0433\u0438\u0435 \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e \u043d\u0435\u043c \u0432 <a href=\"https:\/\/geektimes.ru\/post\/274462\/\">\u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0430 Geektimes<\/a>. \u0421\u0430\u0439\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 ajax \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0438 \u043f\u0440\u0438\u044f\u0442\u043d\u043e. \u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/153\/773\/a30\/153773a30f4941c6af156aebba590fbd.PNG\" alt=\"\u041a\u0414\u041f\u0412\"\/><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/h2>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0430\u0439\u0442 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e8d\/3dd\/a6f\/e8d3dda6f5f54ae39c8e7a529b2c5ca3.PNG\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u043c\u0435\u044e\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 URL <a href=\"https:\/\/www.captionbot.ai\/api\">https:\/\/www.captionbot.ai\/api<\/a><\/p>\n<p>  <\/p>\n<h3>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0441\u0430\u0439\u0442\u0430 \u0438\u0434\u0435\u0442 GET \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 <code>\/api\/init<\/code> \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<br \/>  \u041e\u0442\u0432\u0435\u0442 \u0438\u043c\u0435\u0435\u0442 <code>Content-Type: application\/json<\/code>, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0442\u0435\u043b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0438\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code>&quot;54cER5HILuE&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u044d\u0442\u043e \u0438 \u0438\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<h3>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 URL<\/h3>\n<p>  <\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435: \u0447\u0435\u0440\u0435\u0437 URL \u0438 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u0431\u0435\u0440\u0435\u043c URL \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u041b\u0435\u043d\u044b \u0441 \u0432\u0438\u043a\u0438 \u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u0435\u043c. \u0412 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f POST \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 <code>\/api\/message<\/code> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code>{     &quot;conversationId&quot;: &quot;54cER5HILuE&quot;,     &quot;waterMark&quot;: &quot;&quot;,     &quot;userMessage&quot;: &quot;https:\/\/upload.wikimedia.org\/wikipedia\/ru\/2\/24\/Lenna.png&quot; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u0433\u0430, \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0441\u0435\u0431\u0435 \u043c\u044b, \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u0435\u0442\u043e\u0434 <code>init<\/code> \u0432\u0435\u0440\u043d\u0443\u043b \u043d\u0430\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f <code>conversationId<\/code>, \u0430 \u0432 <code>userMessage<\/code> \u043f\u043e\u043f\u0430\u043b\u0430 \u043d\u0430\u0448\u0430 \u0441\u0441\u044b\u043b\u043a\u0430. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <code>waterMark<\/code> \u043f\u043e\u043a\u0430 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code>&quot;{\\&quot;ConversationId\\&quot;:null,\\&quot;WaterMark\\&quot;:\\&quot;131071012038902294\\&quot;,\\&quot;UserMessage\\&quot;:\\&quot;I am not really confident, but I think it's a woman wearing a hat\\\\nand she seems . \\&quot;,\\&quot;Status\\&quot;:null}&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0447\u0435\u043c-\u0442\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b\u0438 JSON \u0434\u0432\u0430\u0436\u0434\u044b, \u043d\u0443 \u0434\u0430 \u043b\u0430\u0434\u043d\u043e. \u0412 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code>{     &quot;ConversationId&quot;: null,     &quot;WaterMark&quot;: &quot;131071012038902294&quot;,     &quot;UserMessage&quot;: &quot;I am not really confident, but I think it's a woman wearing a hat\\\\nand she seems .&quot;,     &quot;Status&quot;: null }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e \u043f\u0443\u0442\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u043c\u0430\u043d\u0435\u0440\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u043d\u043e \u044d\u0442\u043e \u043c\u0435\u043b\u043e\u0447\u0438 \u0436\u0438\u0437\u043d\u0438. \u0418\u0442\u0430\u043a, \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>WaterMark<\/code>, \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043f\u0443\u0441\u0442\u043e\u0439 <code>ConversationId<\/code>, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043a \u0444\u043e\u0442\u043e \u0432 \u043f\u043e\u043b\u0435 <code>UserMessage<\/code> \u0438 \u043d\u0435\u043a\u0438\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u0443\u0441.<\/p>\n<p>  <\/p>\n<h3>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044f \u0432\u043a\u043b\u0430\u0434\u043a\u0443, \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0442\u0443 \u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0441 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0444\u043e\u0442\u043e \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u0412\u0438\u0434\u0438\u043c POST \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 <code>\/api\/upload<\/code> \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <code>multipart\/form-data<\/code> \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u044f <code>file<\/code>:<\/p>\n<p>  <\/p>\n<pre><code>-----------------------------50022246920687 Content-Disposition: form-data; name=&quot;file&quot;; filename=&quot;Lenna.png&quot; Content-Type: image\/png<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 URL \u043d\u0430\u0448\u0435\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u043d\u0435\u043c\u0443 \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code>&quot;https:\/\/captionbot.blob.core.windows.net\/images-container\/2ogw3q4m.png&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043e\u0442\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u043d\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 <code>\/api\/message<\/code>:<\/p>\n<p>  <\/p>\n<pre><code>{     &quot;conversationId&quot;: &quot;54cER5HILuE&quot;,     &quot;waterMark&quot;: &quot;131071012038902294&quot;,     &quot;userMessage&quot;: &quot;https:\/\/captionbot.blob.core.windows.net\/images-container\/2ogw3q4m.png&quot; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0441\u044f <code>waterMark<\/code> \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430, \u0430 URL \u0442\u043e\u0442, \u0447\u0442\u043e \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u0443\u043b \u043c\u0435\u0442\u043e\u0434 <code>upload<\/code>. \u0414\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c.<\/p>\n<p>  <\/p>\n<h2>\u041f\u0438\u0448\u0435\u043c \u043e\u0431\u0435\u0440\u0442\u043a\u0443<\/h2>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u0441 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e\u043c, \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043b\u044e\u0431\u0438\u043c\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u042f \u0441\u0434\u0435\u043b\u0430\u044e \u044d\u0442\u043e \u043d\u0430 Python. \u0414\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0441\u0430\u0439\u0442\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e requests, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u0432 \u043d\u0435\u043c \u0435\u0441\u0442\u044c \u0441\u0435\u0441\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442 cookie \u0437\u0430 \u043c\u0435\u043d\u044f. \u0421\u0430\u0439\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 SSL, \u043d\u043e \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 requests \u0431\u0443\u0434\u0435\u0442 \u0440\u0443\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442:<\/p>\n<p>  <\/p>\n<pre><code>hostname 'www.captionbot.ai' doesn't match either of '*.azurewebsites.net', '*.scm.azurewebsites.net', '*.azure-mobile.net', '*.scm.azure-mobile.net'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0444\u043b\u0430\u0433\u0430 verify=False \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import json import mimetypes import os import requests import logging logger = logging.getLogger(&quot;captionbot&quot;)  class CaptionBot:     BASE_URL = &quot;https:\/\/www.captionbot.ai\/api\/&quot;      def __init__(self):         self.session = requests.Session()         url = self.BASE_URL + &quot;init&quot;         resp = self.session.get(url, verify=False)         logger.debug(&quot;init: {}&quot;.format(resp))         self.conversation_id = json.loads(resp.text)         self.watermark = ''      def _upload(self, filename):         url = self.BASE_URL + &quot;upload&quot;         mime = mimetypes.guess_type(filename)[0]         name = os.path.basename(filename)         files = {'file': (name, open(filename, 'rb'), mime)}         resp = self.session.post(url, files=files, verify=False)         logger.debug(&quot;upload: {}&quot;.format(resp))         return json.loads(resp.text)      def url_caption(self, image_url):         data = json.dumps({             &quot;userMessage&quot;: image_url,             &quot;conversationId&quot;: self.conversation_id,             &quot;waterMark&quot;: self.watermark         })         headers = {             &quot;Content-Type&quot;: &quot;application\/json&quot;         }         url = self.BASE_URL + &quot;message&quot;         resp = self.session.post(url, data=data, headers=headers, verify=False)         logger.debug(&quot;url_caption: {}&quot;.format(resp))         if not resp.ok:             return None         res = json.loads(json.loads(resp.text))         self.watermark = res.get(&quot;WaterMark&quot;)         return res.get(&quot;UserMessage&quot;)      def file_caption(self, filename):         upload_filename = self._upload(filename)         return self.url_caption(upload_filename)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0435\u0441\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/lucky-user\/captionbot\">Github<\/a>, \u043f\u043b\u044e\u0441 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0432 <a href=\"https:\/\/pypi.python.org\/pypi\/captionbot\">pip<\/a>.<\/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=\"https:\/\/habrahabr.ru\/post\/283112\/\"> https:\/\/habrahabr.ru\/post\/283112\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API \u0441\u0430\u0439\u0442\u0430, \u0435\u0441\u043b\u0438 \u043f\u043e \u043d\u0435\u043c\u0443 \u043d\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u043e\u043d\u043e \u0435\u0449\u0435 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e. \u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u0437\u0430\u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API. \u0414\u043b\u044f \u0442\u0435\u0445 \u0436\u0435 \u043a\u0442\u043e \u0441\u0430\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442. <\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0431\u043e\u0440 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 API \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <a href=\"https:\/\/www.captionbot.ai\/\">https:\/\/www.captionbot.ai\/<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u043b Microsoft (\u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0438\u043c \u0437\u0430 \u044d\u0442\u043e). \u041c\u043d\u043e\u0433\u0438\u0435 \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e \u043d\u0435\u043c \u0432 <a href=\"https:\/\/geektimes.ru\/post\/274462\/\">\u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0430 Geektimes<\/a>. \u0421\u0430\u0439\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 ajax \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0438 \u043f\u0440\u0438\u044f\u0442\u043d\u043e. \u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/153\/773\/a30\/153773a30f4941c6af156aebba590fbd.PNG\" alt=\"\u041a\u0414\u041f\u0412\"\/><\/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-279751","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/279751","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=279751"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/279751\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=279751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=279751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=279751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}