title: xmpp session xml requests through python <stream:error><xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
body: <p>Hello I am trying to connect to the chat servers from RIOT I got the authorization tokens etc, it's just connecting with xml what's left.
  The issue is I keep getting
  <code>&lt;?xml version='1.0'?&gt;&lt;stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='944525114' from='eu1.pvp.net' version='1.0'&gt;&lt;stream:error&gt;&lt;xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/&gt;&lt;/stream:error&gt;&lt;/stream:stream&gt;</code></p>
  <p>This is my code `</p>
  <pre><code>messages = [
  f'&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;stream:stream to=&quot;{XMPPRegion}.pvp.net&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; xmlns:stream=&quot;http://etherx.jabber.org/streams&quot;&gt;',
  f'&lt;auth mechanism=&quot;X-Riot-RSO-PAS&quot; xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;&gt;&lt;rso_token&gt;{rso_riot}&lt;/rso_token&gt;&lt;pas_token&gt;{pas_token}&lt;/pas_token&gt;&lt;/auth&gt;',
  f'&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;stream:stream to=&quot;{XMPPRegion}.pvp.net&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; xmlns:stream=&quot;http://etherx.jabber.org/streams&quot;&gt;',
  '&lt;iq id=&quot;_xmpp_bind1&quot; type=&quot;set&quot;&gt;&lt;bind xmlns=&quot;urn:ietf:params:xml:ns:xmpp-bind&quot;&gt;&lt;/bind&gt;&lt;/iq&gt;',
  '&lt;iq id=&quot;_xmpp_session1&quot; type=&quot;set&quot;&gt;&lt;session xmlns=&quot;urn:ietf:params:xml:ns:xmpp-session&quot;/&gt;&lt;/iq&gt;',
  '&lt;iq type=&quot;get&quot; id=&quot;2&quot;&gt;&lt;query xmlns=&quot;jabber:iq:riotgames:roster&quot; last_state=&quot;true&quot; /&gt;&lt;/iq&gt;',]
  
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1_2)
  
  s.connect((address, port))
  print(s)
  for message in messages:
      print(&quot;--&gt;&quot;, message)
      s.send(message.encode('utf-8'))
      print(&quot;&lt;--&quot;,s.recv(4096).decode('utf-8'))
  s.close()`
  </code></pre>
  <p>This is what I receive (last one is the error)</p>
  <pre><code>&lt;ssl.SSLSocket fd=1276, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.0.227', 63700), raddr=('172.65.252.238', 5223)&gt;
   --&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;stream:stream to=&quot;eu1.pvp.net&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; xmlns:stream=&quot;http://etherx.jabber.org/streams&quot;&gt;
   &lt;-- &lt;?xml version='1.0'?&gt;&lt;stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='3755973004' from='eu1.pvp.net' version='1.0'&gt;
   --&gt; &lt;auth mechanism=&quot;X-Riot-RSO-PAS&quot; xmlns=&quot;urn:ietf:params:xml:ns:xmpp-sasl&quot;&gt;&lt;rso_token&gt;Deleted for post&lt;/rso_token&gt;&lt;pas_token&gt;Deleted for post&lt;/pas_token&gt;&lt;/auth&gt;
   &lt;-- &lt;stream:features&gt;&lt;mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'&gt;&lt;mechanism&gt;X-Riot-RSO&lt;/mechanism&gt;&lt;mechanism&gt;X-Riot-RSO-PAS&lt;/mechanism&gt;&lt;/mechanisms&gt;&lt;/stream:features&gt;
   --&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;stream:stream to=&quot;eu1.pvp.net&quot; xml:lang=&quot;en&quot; version=&quot;1.0&quot; xmlns=&quot;jabber:client&quot; xmlns:stream=&quot;http://etherx.jabber.org/streams&quot;&gt;
   &lt;-- &lt;success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'&gt;1656214306&lt;/success&gt;
   --&gt; &lt;iq id=&quot;_xmpp_bind1&quot; type=&quot;set&quot;&gt;&lt;bind xmlns=&quot;urn:ietf:params:xml:ns:xmpp-bind&quot;&gt;&lt;/bind&gt;&lt;/iq&gt;
   &lt;-- &lt;?xml version='1.0'?&gt;&lt;stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='1706247727' from='eu1.pvp.net' version='1.0'&gt;&lt;stream:error&gt;&lt;xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/&gt;&lt;/stream:error&gt;&lt;/stream:stream&gt;
  </code></pre>