title: Redis - Python example of xadd and xread
body: <p>Could you give a very simple example of using Redis' <code>xread</code> and <code>xadd</code> in Python ( that displays the type and format of return values form xread and input of xadd)? I've already read many documentation but none of them are in Python.</p>
  
  <p>The Redis <a href="https://redis.io/topics/streams-intro" rel="noreferrer">doc</a> gives an example:</p>
  
  <pre><code>&gt; XADD mystream * sensor-id 1234 temperature 19.8
  1518951480106-0
  </code></pre>
  
  <p>but If I try in python:</p>
  
  <pre class="lang-py prettyprint-override"><code>sample = {b"hello":b"12"}
  id = r.xadd("mystream", sample)
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre class="lang-py prettyprint-override"><code>redis.exceptions.ResponseError: WRONGTYPE Operation against a key holding the wrong kind of value
  </code></pre>