{"id":215083,"date":"2014-03-08T13:11:03","date_gmt":"2014-03-08T09:11:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=215083"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=215083","title":{"rendered":"<span class=\"post_title\">\u0412\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043a\u043e\u0444\u0435\u0432\u0430\u0440\u043a\u0438 \u043d\u0430 Ajenti \u0447\u0435\u0440\u0435\u0437 HTCPCP<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0430\u0434\u043e\u0435\u043b\u043e \u0431\u0435\u0433\u0430\u0442\u044c \u0437\u0430 \u043a\u043e\u0444\u0435 \u0438 \u0436\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0438 \u043d\u0430 \u043a\u043e\u0444\u0435\u0432\u0430\u0440\u043a\u0435? \u0421\u0434\u0435\u043b\u0430\u0439 \u043a \u043d\u0435\u0439 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441!<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d40\/f27\/2ab\/d40f272abe73c16ecfbb1b92af3cb345.png\"\/><\/p>\n<p>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/NYPBZVcLNa8?wmode=opaque\" frameborder=\"0\" allowfullscreen><\/iframe><br \/>  <a name=\"habracut\"><\/a><br \/>  <i>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/Eugeny\/Cofeepot-Example\/\">Github<\/a>.<\/i><\/p>\n<h5>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h5>\n<p>  \u0421\u043a\u0430\u0447\u0430\u0435\u043c Ajenti c <a href=\"https:\/\/pypi.python.org\/pypi\/ajenti\">PyPI<\/a> \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u0443\u0435\u043c. <br \/>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"bash\">sudo pip install -Ur requirements.txt <\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0430\u044f <a href=\"http:\/\/ru.wikipedia.org\/wiki\/HTCPCP\">HTCPCP<\/a> \u043a\u043e\u0444\u0435\u0432\u0430\u0440\u043a\u0430, \u0430 \u0435\u0441\u043b\u0438 \u0435\u0435 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u2014 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/Eugeny\/Cofeepot-Example\/blob\/master\/coffeepot-flask.py\">\u043f\u0440\u043e\u0441\u0442\u044b\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u043c<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u043b\u043e\u043a\u0430 \u0438 \u0448\u043e\u043a\u043e\u043b\u0430\u0434\u0430!<\/p>\n<h5>HTCPCP-\u043a\u043b\u0438\u0435\u043d\u0442<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 <b>ajenti\/plugins<\/b> \u043f\u0430\u043f\u043a\u0443 htcpcp, \u0430 \u0432 \u043d\u0435\u0439 \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430:<\/p>\n<pre><code>ajenti\/plugins\/htcpcp \u251c\u2500\u2500 __init__.py \u251c\u2500\u2500 client.py \u2514\u2500\u2500 layout  \u00a0\u00a0 \u2514\u2500\u2500 config.xml  <\/code><\/pre>\n<p>  \u0412 <b>__init__.py<\/b> \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0435:<\/p>\n<pre><code class=\"python\">from ajenti.api import * from ajenti.plugins import *   info = PluginInfo(     title='HTCPCP Example',     icon='coffee',     dependencies=[         PluginDependency('main')     ], )   def init():     import client     import main <\/code><\/pre>\n<p>  \u0412 client.py \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c HTCPCP:<\/p>\n<pre><code class=\"python\">import requests  from ajenti.api import * from ajenti.plugins.configurator.api import ClassConfigEditor   @plugin class HTCPCPClientConfigEditor (ClassConfigEditor):     &quot;&quot;&quot;     A plugin that handles editing of HTCPCPClient's classconfig     &quot;&quot;&quot;     title = 'HTCPCP Client'     icon = 'coffee'      def init(self):         self.append(self.ui.inflate('htcpcp:config'))  # htcpcp\/layout\/config.xml   class CoffeeAddition (object):     def __init__(self, name):         self.name = name         self.selected = False   @plugin class HTCPCPClient (BasePlugin):     classconfig_editor = HTCPCPClientConfigEditor  # connect this plugin with a ConfigEditor     default_classconfig = {'url': 'htcpcp:\/\/127.0.0.1:5000'}      def init(self):         self.additions = []      def check_connectivity(self):         resp = requests.request('PROPFIND', self.get_url())         if resp.status_code == 418:             raise Exception('This coffee pot is a teapot')      def refresh(self):         resp = requests.request('PROPFIND', self.get_url())         self.additions = [CoffeeAddition(x) for x in resp.headers['Additions-List'].split(';')]      def get_url(self):         return self.classconfig['url'].replace('htcpcp', 'http')      def brew(self):         &quot;&quot;&quot;         Brew coffee with selected additions         &quot;&quot;&quot;         return requests.request('BREW', self.get_url(), headers={             'Accept-Additions': ';'.join(x.name for x in self.additions if x.selected)         })      def retrieve(self):         return requests.request('GET', self.get_url())  <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <b>ConfigEditor<\/b> API, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 <b>HTCPCPClient<\/b> \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e URL \u043a\u043e\u0444\u0435\u0432\u0430\u0440\u043a\u0438.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u0440\u0430\u0437\u0434\u0435\u043b \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 (<b>main.py<\/b>):  <\/p>\n<pre><code class=\"python\">from ajenti.api import * from ajenti.plugins.main.api import SectionPlugin  from client import HTCPCPClient   @plugin class CoffeePlugin (SectionPlugin):     &quot;&quot;&quot;     A HTCPCP capable coffeepot control plugin     &quot;&quot;&quot;      def init(self):         self.title = 'Coffeepot'         self.icon = 'coffee'         self.category = _('System')          # IoC: \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 HTCPCPClient         self.pot = HTCPCPClient.get()  <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e UI \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0430\u043d\u0435\u043b\u044c:<\/p>\n<pre><code class=\"xml\">&lt;bind:dict id=&quot;bind&quot;&gt; &lt;!-- \u041f\u043b\u0430\u0433\u0438\u043d \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0441\u0432\u044f\u0436\u0435\u0442 \u044d\u0442\u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c .classconfig \u043a\u043b\u0430\u0441\u0441\u0430 --&gt;     &lt;formline text=&quot;Coffeepot URL&quot;&gt;         &lt;textbox bind=&quot;url&quot; \/&gt;     &lt;\/formline&gt; &lt;\/bind:dict&gt; <\/code><\/pre>\n<pre><code class=\"bash\">make run <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u0432 \u0440\u0430\u0437\u0434\u0435\u043b Configure &gt; Plugins, \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0430\u0448 \u043f\u043b\u0430\u0433\u0438\u043d \u0438 \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c URL.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/8d3\/729\/65b\/8d372965bfb66fbcba854805986744af.png\"\/><br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/674\/ee5\/3ec\/674ee53ec972c8c77ec1c5e9eabe2fd5.png\"\/><\/p>\n<h5>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/h5>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u0447\u0435\u043a!<\/p>\n<p>  <b>htcpcp\/layout\/main.xml<\/b>:  <\/p>\n<pre><code class=\"xml\">    &lt;hc&gt;         &lt;button id=&quot;brew&quot; icon=&quot;arrow-right&quot; text=&quot;Brew&quot; \/&gt;         &lt;button id=&quot;retrieve&quot; icon=&quot;coffee&quot; text=&quot;Retrieve&quot; \/&gt;         &lt;button id=&quot;refresh&quot; icon=&quot;refresh&quot; text=&quot;Refresh&quot; \/&gt;     &lt;\/hc&gt; <\/code><\/pre>\n<p>  <b>htcpcp\/main.py<\/b>:  <\/p>\n<pre><code class=\"python\">from ajenti.api import * from ajenti.plugins.main.api import SectionPlugin from ajenti.ui import on from ajenti.ui.binder import Binder  from client import HTCPCPClient   @plugin class CoffeePlugin (SectionPlugin):     &quot;&quot;&quot;     A HTCPCP capable coffeepot control plugin     &quot;&quot;&quot;      def init(self):         self.title = 'Coffeepot'         self.icon = 'coffee'         self.category = _('System')         self.append(self.ui.inflate('htcpcp:main'))  # htcpcp\/layout\/main.xml         self.pot = HTCPCPClient.get()      def on_page_load(self):         try:             self.pot.check_connectivity()         except Exception, e:             self.context.notify('error', 'Could not access the coffee pot: %s!' % str(e))             self.context.launch('configure-plugin', plugin=self.pot) # \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043c \u043f\u043b\u0430\u0433\u0438\u043d Configure \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u043a\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a      @on('brew', 'click')     def on_brew(self):         resp = self.pot.brew()         if resp.status_code == 200:             self.context.notify('info', 'Brewing')         else:             self.context.notify('error', resp.text)      @on('refresh', 'click')     def on_refresh(self):         # \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0444\u0435\u0439\u043d\u044b\u0445 \u0434\u043e\u0431\u0430\u0432\u043e\u043a         self.pot.refresh()      @on('retrieve', 'click')     def on_retrieve(self):         resp = self.pot.retrieve()         if resp.status_code == 200:             self.context.notify('info', resp.text)         else:             self.context.notify('error', resp.text) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0436\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043e\u0447\u043a\u0438 \u0438 \u0432\u0430\u0440\u0438\u0442\u044c \u043a\u043e\u0444\u0435 \ud83d\ude42<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/1bc\/c01\/e8d\/1bcc01e8d6614a6e9b1b5f4d2e7e2500.png\"\/><\/p>\n<h5>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/h5>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043a\u043e\u0444\u0435\u0439\u043d\u044b\u0445 \u0434\u043e\u0431\u0430\u0432\u043e\u043a \u0438 \u0438\u0445 \u0432\u044b\u0431\u043e\u0440. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 UI \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043b\u0430\u0441\u0441 <b>Binder<\/b>.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <b>main.xml<\/b> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u043e\u0432 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043e\u043a:  <\/p>\n<pre><code class=\"xml\">&lt;vc&gt;     &lt;body&gt;         &lt;pad id=&quot;pot-root&quot;&gt; &lt;!-- id \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f --&gt;             &lt;bind:collection bind=&quot;additions&quot;&gt; &lt;!-- \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 CoffeeAdditions \u0438\u0437 HTCPCPClient.additions --&gt;                 &lt;vc bind=&quot;__items&quot;&gt; &lt;!-- \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 &lt;vc&gt; --&gt;                     &lt;label style=&quot;bold&quot; text=&quot;Available additions:&quot; \/&gt;                 &lt;\/vc&gt;                 &lt;bind:template&gt; &lt;!-- \u0448\u0430\u0431\u043b\u043e\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 --&gt;                     &lt;checkbox bind:value=&quot;selected&quot; bind:text=&quot;name&quot; \/&gt; &lt;!-- \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c value \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430 \u0441 addition.selected, \u0430 text - c addition.name --&gt;                 &lt;\/bind:template&gt;             &lt;\/bind:collection&gt;         &lt;\/pad&gt;     &lt;\/body&gt;      &lt;hc&gt;         &lt;button id=&quot;brew&quot; icon=&quot;arrow-right&quot; text=&quot;Brew&quot; \/&gt;         &lt;button id=&quot;retrieve&quot; icon=&quot;coffee&quot; text=&quot;Retrieve&quot; \/&gt;         &lt;button id=&quot;refresh&quot; icon=&quot;refresh&quot; text=&quot;Refresh&quot; \/&gt;     &lt;\/hc&gt; &lt;\/vc&gt; <\/code><\/pre>\n<p>  \u0410 \u0432 main.py \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Binder, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e\u0431\u0430\u0432\u043e\u043a (\u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u043e\u0432):<\/p>\n<pre><code class=\"python\">from ajenti.api import * from ajenti.plugins.main.api import SectionPlugin from ajenti.ui import on from ajenti.ui.binder import Binder  from client import HTCPCPClient   @plugin class CoffeePlugin (SectionPlugin):     &quot;&quot;&quot;     A HTCPCP capable coffeepot control plugin     &quot;&quot;&quot;      def init(self):         self.title = 'Coffeepot'         self.icon = 'coffee'         self.category = _('System')          self.append(self.ui.inflate('htcpcp:main'))          self.pot = HTCPCPClient.get()          # \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c binder \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (\u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c HTCPCPClient self.pot \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 id=pot-root)         self.binder = Binder(self.pot, self.find('pot-root'))      def on_page_load(self):         try:             self.pot.check_connectivity()         except Exception, e:             self.context.notify('error', 'Could not access the coffee pot: %s!' % str(e))             self.context.launch('configure-plugin', plugin=self.pot)             return                   if not self.pot.additions:             # \u0415\u0441\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043a\u0438 \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0445             self.pot.refresh()             # \u041f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 UI             self.binder.populate()      @on('brew', 'click')     def on_brew(self):         # \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 UI         self.binder.update()         resp = self.pot.brew()         if resp.status_code == 200:             self.context.notify('info', 'Brewing')         else:             self.context.notify('error', resp.text)      @on('refresh', 'click')     def on_refresh(self):         self.pot.refresh()         # \u041f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 UI         self.binder.populate()      @on('retrieve', 'click')     def on_retrieve(self):         resp = self.pot.retrieve()         if resp.status_code == 200:             self.context.notify('info', resp.text)         else:             self.context.notify('error', resp.text)  <\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e \ud83d\ude42<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d40\/f27\/2ab\/d40f272abe73c16ecfbb1b92af3cb345.png\"\/><\/p>\n<p>  \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u043a\u043e\u0434 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/Eugeny\/Cofeepot-Example\/\">Github<\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 <a href=\"http:\/\/docs.ajenti.org\">\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a> \u0438 \u043f\u043e\u0434\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/Eugeny\/ajenti\/tree\/dev\/ajenti\/plugins\/test\">\u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/a>.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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\/215083\/\"> http:\/\/habrahabr.ru\/post\/215083\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0430\u0434\u043e\u0435\u043b\u043e \u0431\u0435\u0433\u0430\u0442\u044c \u0437\u0430 \u043a\u043e\u0444\u0435 \u0438 \u0436\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0438 \u043d\u0430 \u043a\u043e\u0444\u0435\u0432\u0430\u0440\u043a\u0435? \u0421\u0434\u0435\u043b\u0430\u0439 \u043a \u043d\u0435\u0439 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441!<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d40\/f27\/2ab\/d40f272abe73c16ecfbb1b92af3cb345.png\"\/><\/p>\n<p>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/NYPBZVcLNa8?wmode=opaque\" frameborder=\"0\" allowfullscreen><\/iframe>  <\/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-215083","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/215083","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=215083"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/215083\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=215083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=215083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=215083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}