Site updated at 2016-07-14 07:38:39 UTC

This commit is contained in:
Travis CI 2016-07-14 07:38:39 +00:00
parent d357527968
commit eb6acd4648
23 changed files with 99 additions and 58 deletions

View file

@ -103,12 +103,12 @@
<h3><a class="title-link" name="website" href="#website"></a> Website</h3>
<ol>
<li>Create a blog post and base it on the PR text. Add images, additional text, links, etc. if it adds value. Tag each platform/component in message to documentation.</li>
<li>Create missing documentation as stumbs.</li>
<li>Create a pull request from <code>next</code> to <code>master</code> with the upcoming release number as title.</li>
<li>Merge <code>master</code> into <code>next</code> (<code>git checkout next &amp;&amp; git merge master</code>) to make the PR mergable.</li>
<li>Create a blog post in <code>next</code> and base it on the text of the PR in the main repository. Add images, additional text, links, etc. if it adds value. Tag each platform/component in message to documentation.</li>
<li>Create missing documentation as stumbs in <code>next</code>.</li>
<li>Update the link on the frontpage (<code>source/index.html</code>) to link to the new release blog post and version number.</li>
<li>Merge blog post and updated frontpage to <code>master</code> (<code>git merge next</code>).</li>
<li>Create a pull request from <code>next</code> to <code>master</code> with the upcoming release number as title.</li>
<li>Merge <code>master</code> into <code>next</code> (<code>$ git checkout next &amp;&amp; git merge master</code>) to make the PR mergable.</li>
<li>Merge pull request (blog post, updated frontpage, and all new documentation) to <code>master</code>.</li>
</ol>
<h3><a class="title-link" name="python-package-index" href="#python-package-index"></a> Python Package Index</h3>

View file

@ -98,7 +98,7 @@
<p>There are various ways to access the stream. One is <code>curl</code>:</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>$ curl -X GET -H &quot;x-ha-access: YOUR_PASSWORD&quot; \
<div class="code"><pre>$ curl -X GET -H &quot;x-ha-access: 12345&quot; \
-H &quot;Content-Type: application/json&quot; http://localhost:8123/api/stream
</pre></div>
</div>
@ -126,10 +126,34 @@
<p>Visit <a href="http://localhost:8123/local/sse.html">http://localhost:8123/local/sse.html</a> to see the stream of events.</p>
<h3><a class="title-link" name="example" href="#example"></a> Example</h3>
<h2><a class="title-link" name="examples" href="#examples"></a> Examples</h2>
<h3><a class="title-link" name="website" href="#website"></a> Website</h3>
<p>The <a href="https://github.com/fabaff/home-assistant-sse">home-assistant-sse</a> repository contains an more advanced example.</p>
<h3><a class="title-link" name="python" href="#python"></a> Python</h3>
<p>If you want test the server-sent events without creating a website then the Python module <a href="https://pypi.python.org/pypi/sseclient/"><code>sseclient</code> </a> can help. Install it first:</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>$ pip3 install sseclient
</pre></div>
</div>
</div>
<p>The simplest script to consume the SSE looks like the following snipplet.</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre><span class="keyword">from</span> <span class="include">sseclient</span> <span class="keyword">import</span> <span class="include">SSEClient</span>
messages = SSEClient(<span class="string"><span class="delimiter">'</span><span class="content">http://localhost:8123/api/stream?api_password=MYPASS</span><span class="delimiter">'</span></span>)
<span class="keyword">for</span> msg <span class="keyword">in</span> messages:
print(msg)
</pre></div>
</div>
</div>
</article>