{"id":307130,"date":"2020-07-18T03:00:17","date_gmt":"2020-07-18T03:00:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307130"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-07-18T03:00:17","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307130","title":{"rendered":"\u041f\u043e\u0433\u043e\u0434\u0430-\u0431\u043e\u0442: DialogFlow + OpenWeather + Python"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/511494\/\">\n<h3>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u0442\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043b \u0431\u044b \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0430\u044f \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0434\u0430 \u0432 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0438 \u0432\u044b\u0434\u0430\u0432\u0430\u043b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u0433\u043e\u0434\u0435.<\/p>\n<h3>DialogFlow<\/h3>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0447\u0438 \u043a\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a DialogFlow, \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 \u043d\u0435\u0433\u043e ML. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0430\u0431\u043e\u0442\u0435.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/dialogflow.cloud.google.com\/\" rel=\"nofollow\">https:\/\/dialogflow.cloud.google.com\/<\/a>, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c\u0441\u044f \u0432 \u0441\u0432\u043e\u0435\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 \u0433\u0443\u0433\u043b \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u043e\u0442\u0430. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u00abCreate new agent\u00bb \u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u0438\u043c\u044f \u0430\u0433\u0435\u043d\u0442\u0443: \u00abweather-bot\u00bb. \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u0440\u0443\u0441\u0441\u043a\u0438\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8f8\/688\/8e2\/8f86888e27a483d675ff2e7efac35a7c.jpg\" alt=\"image\"><\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 DialogFlow \u2014 \u0438\u043d\u0442\u0435\u043d\u0442\u044b \u0438\u043b\u0438 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 \u0431\u043e\u0442\u043e\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0435 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u0435, \u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u0430\u0441 \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u2014 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0435 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u043c\u0438 \u0444\u0440\u0430\u0437\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0431\u043e\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u0433\u0430\u0434\u044b\u0432\u0430\u043b \u0442\u043e\u0442 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u043d\u0442. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u00abIntents\u00bb. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0431\u043e\u0442\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0438\u043d\u0442\u0435\u043d\u0442\u0430: \u00abDefault Fallback Intent\u00bb \u0438 \u00abDefault Welcome Intent\u00bb. Welcome Intent \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0443\u0441\u043a \u0431\u043e\u0442\u0430 \u043b\u0438\u0431\u043e \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u0435\u043c\u0443 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. Fallback \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0431\u043e\u0442 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b \u0435\u043c\u0443 \u043f\u0438\u0448\u0435\u0442\u0435, \u0442.\u0435. \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u043d\u0438 \u043e\u0434\u0438\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0442\u0435\u043d\u0442 \u043d\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442. \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u043d\u0442\u044b \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u0436\u043c\u0435\u043c \u043d\u0430 \u00abCreate intent\u00bb, \u043d\u0430\u0437\u044b\u0432\u0430\u044f \u0435\u0433\u043e \u00abget-weather\u00bb. \u0418\u043c\u0435\u043d\u043d\u043e \u0441 \u044d\u0442\u0438\u043c \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u0435\u043c \u043c\u044b \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a54\/124\/91f\/a5412491f44083efa1d869fb460a874e.jpg\" alt=\"image\"><\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043d\u0430\u0448 \u0438\u043d\u0442\u0435\u043d\u0442 \u00abget-weather\u00bb, \u0437\u0430\u0442\u0435\u043c \u2014 \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u00abTraining phrases\u00bb \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0444\u0440\u0430\u0437, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u0445:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/33f\/150\/484\/33f150484fe09d99fa1d2eed6cabd89c.jpg\" alt=\"image\"><\/p>\n<p>  \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e DialogFlow \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0433\u043e\u0440\u043e\u0434\u0430 \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b location. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0430\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u0431\u044d\u043a\u0435\u043d\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0412 \u0441\u0430\u043c\u043e\u043c DialogFlow \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u2014 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0435\u043c\u0443 \u0432\u0435\u0431\u0445\u0443\u043a\u0438 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043b\u0438\u0441\u0442\u0430\u0435\u043c \u0432 \u0441\u0430\u043c\u044b\u0439 \u043d\u0438\u0437, \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u00abFulfillment\u00bb \u0438 \u0441\u0442\u0430\u0432\u0438\u043c \u0433\u0430\u043b\u043e\u0447\u043a\u0443 \u043d\u0430 \u00abEnable webhook call for this intent\u00bb.<\/p>\n<h3>\u0411\u044d\u043a<\/h3>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430. \u041f\u0438\u0441\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043d\u0430 Python \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 Flask. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u0433\u043e\u0434\u0435 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d <a href=\"https:\/\/openweathermap.org\/\" rel=\"nofollow\">OpenWeather API<\/a>. \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u044d\u0442\u043e\u043c \u0441\u0430\u0439\u0442\u0435, \u0437\u0430\u0442\u0435\u043c \u0432\u0430\u043c \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 \u043f\u0440\u0438\u0434\u0435\u0442 API KEY \u2014 \u043e\u043d \u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u0433\u043e\u0434\u0435 \u0432 \u044d\u0442\u043e\u043c API \u0432\u044b\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c latitude \u0438 longitude \u2014 \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u0430 \u2014 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u0430\u043a-\u0442\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0433\u043e\u0440\u043e\u0434 \u0432 \u0435\u0433\u043e \u0448\u0438\u0440\u0438\u043d\u0443 \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u0443. \u0412 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 Python-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 geopy.<\/p>\n<p>  \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435:<\/p>\n<pre><code class=\"python\">from flask import Flask, request, make_response, jsonify import requests import json from geopy.geocoders import Nominatim<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c Flask application:<\/p>\n<pre><code class=\"python\">app = Flask(__name__)<\/code><\/pre>\n<p>  \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e API_KEY \u0441\u0432\u043e\u0439 API KEY:<\/p>\n<pre><code class=\"python\">API_KEY = '&lt;your_API_KEY_here&gt;'<\/code><\/pre>\n<p>  \u041f\u0438\u0448\u0435\u043c \u0440\u043e\u0443\u0442 \u0434\u043b\u044f \u043f\u0443\u0442\u0438 &quot;\/&quot;:<\/p>\n<pre><code class=\"python\">@app.route('\/') def index():     return 'Hello World!'<\/code><\/pre>\n<p>  \u0438 \u0434\u0430\u043b\u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e results(), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0430 \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"python\">def results():     req = request.get_json(force=True)      action = req.get('queryResult').get('action')      result = req.get(&quot;queryResult&quot;)     parameters = result.get(&quot;parameters&quot;)      if parameters.get('location').get('city'):         geolocator = Nominatim(user_agent='weather-bot')         location = geolocator.geocode(parameters.get('location').get('city'))         lat = location.latitude         long = location.longitude         weather_req = requests.get('https:\/\/api.openweathermap.org\/data\/2.5\/onecall?lat={}&amp;lon={}&amp;appid={}'.format(lat, long, API_KEY))         current_weather = json.loads(weather_req.text)['current']         temp = round(current_weather['temp'] - 273.15)         feels_like = round(current_weather['feels_like'] - 273.15)         clouds = current_weather['clouds']         wind_speed = current_weather['wind_speed']      return {'fulfillmentText': '\u0421\u0435\u0439\u0447\u0430\u0441 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0432\u043e\u0437\u0434\u0443\u0445\u0430 - {} \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432, \u043e\u0449\u0443\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a {} \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432, \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0441\u0442\u044c - {}%, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u0435\u0442\u0440\u0430 - {}\u043c\/\u0441'.format(str(temp), str(feels_like), str(clouds), str(wind_speed))} <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u043e\u0443\u0442, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e webhook:<\/p>\n<pre><code class=\"python\">@app.route('\/webhook', methods=['GET', 'POST']) def webhook():     return make_response(jsonify(results()))<\/code><\/pre>\n<p>  \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"python\">if __name__ == '__main__':    app.run(debug=True)<\/code><\/pre>\n<p>  \u041c\u044b \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c!<\/p>\n<h3>\u0418 \u044d\u0442\u043e \u0432\u0441\u0435?<\/h3>\n<p>  \u041d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u043d\u0430\u0448\u0435\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435, \u043d\u043e DialogFlow \u043e \u043d\u0435\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u0430\u0448\u0438\u043d\u0443 \u0432 \u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u043d\u0443\u0436\u043d\u0430 \u043e\u0441\u043e\u0431\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430. \u042d\u0442\u0438\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 <a href=\"https:\/\/ngrok.com\/\" rel=\"nofollow\">ngrok<\/a>. \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0435\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u00abngrok http 5000\u00bb. \u041f\u043e\u044f\u0432\u0438\u0442\u0441\u044f https-\u0441\u0441\u044b\u043b\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 DialogFlow. \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 Fulfillment \u0432 DialogFlow, \u0441\u0442\u0430\u0432\u0438\u043c Webhook \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 enabled \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043f\u043e\u043b\u0435 \u0441\u0441\u044b\u043b\u043a\u0443. \u0414\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0440\u043e\u0443\u0442, \u0442.\u0435. &quot;\/webhook&quot;. \u0414\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b3b\/23b\/0a2\/b3b23b0a2dac1d7a4f16a3ddaea31663.jpg\" alt=\"image\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448\u0435 Python-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0441 Telegram. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u00abIntegrations\u00bb, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c, \u0434\u0430\u043b\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e \u0442\u043e\u043a\u0435\u043d\u0430, \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043a\u0435\u043d, \u0438 \u0432\u0443\u0430\u043b\u044f \u2014 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e! \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/38d\/5d9\/182\/38d5d9182ec9955cbe8c9bdf73709370.jpg\" alt=\"image\"><\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0438 \u0441\u043f\u043e\u0434\u0432\u0438\u0433\u043d\u0435\u0442 \u043d\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a href=\"https:\/\/github.com\/ashaginyan\/weather-bot\/blob\/master\/back.py\" rel=\"nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/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:\/\/habr.com\/ru\/post\/511494\/\"> https:\/\/habr.com\/ru\/post\/511494\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/511494\/\">\n<h3>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u0442\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043b \u0431\u044b \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0430\u044f \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0434\u0430 \u0432 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0438 \u0432\u044b\u0434\u0430\u0432\u0430\u043b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u0433\u043e\u0434\u0435.<\/p>\n<h3>DialogFlow<\/h3>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0447\u0438 \u043a\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a DialogFlow, \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 \u043d\u0435\u0433\u043e ML. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0430\u0431\u043e\u0442\u0435.  <\/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-307130","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307130","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=307130"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307130\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}