title: Error 125002 while trying to read messages from huawei modem
body: <p>so i want to read some sms received in my huawei modem.
  for this i have to take a token value from one page and reuse it in another pages (sms-list) of my modem</p>
  
  <p>but i got this error 125002 which means that my token value is not accurate</p>
  
  <p>here is my code</p>
  
  <pre><code>import hashlib
  import base64
  import binascii
  import xml.etree.ElementTree as ET
  from datetime import datetime
  import requests
  from bs4 import BeautifulSoup
  
  BASEURL = 'http://192.168.8.1'
  
  
  session = requests.Session()
  reqresponse = session.get(BASEURL + '/api/webserver/SesTokInfo')
  if reqresponse.status_code == 200:
          root = ET.fromstring(reqresponse.text)
          for results in root.iter('SesInfo'):
              sessionid = results.text
              print("the sessionId is", sessionid)
          for results in root.iter('TokInfo'):
              token = results.text
              print("The token is", token)
          sessioncookies = reqresponse.cookies
  
  post_data = '&lt;?xml version = "1.0" encoding = "UTF-8"?&gt;\n'
  post_data += '&lt;request&gt;&lt;PageIndex&gt;1&lt;/PageIndex&gt;&lt;ReadCount&gt;3&lt;/ReadCount&gt;&lt;BoxType&gt;1&lt;/BoxType&gt;&lt;SortType&gt;0&lt;/SortType&gt;&lt;Ascending&gt;0&lt;/Ascending&gt;&lt;UnreadPreferred&gt;1&lt;/UnreadPreferred&gt;&lt;/request&gt;\n'
  
  headers = {'Content-Type': 'text/xml; charset=UTF-8',
                 '__RequestVerificationToken': token,'X-Requested-With: XMLHttpRequest'}
  
  api_url = BASEURL + '/api/sms/sms-list'
  logonresponse = session.post( api_url, data=post_data, headers=headers, cookies=sessioncookies)
  
  
  result = BeautifulSoup(logonresponse.text, 'html.parser')
  
  for r in result:
      print(r)
  
  </code></pre>
  
  <p>from this bash script, i m getting all my message list and it is almost the same principle</p>
  
  <pre><code>RESPONSE=`curl -s -X GET http://192.168.8.1/api/webserver/SesTokInfo`
  COOKIE=`echo "$RESPONSE"| grep SessionID=| cut -b 10-147`
  TOKEN=`echo "$RESPONSE"| grep TokInfo| cut -b 10-41`
  
  
  DATA="&lt;request&gt;&lt;PageIndex&gt;1&lt;/PageIndex&gt;&lt;ReadCount&gt;3&lt;/ReadCount&gt; 
  &lt;BoxType&gt;1&lt;/BoxType&gt;&lt;SortType&gt;0&lt;/SortType&gt;&lt;Ascending&gt;0&lt;/Ascending&gt; 
  &lt;UnreadPreferred&gt;1&lt;/UnreadPreferred&gt;&lt;/request&gt;"
  
  curl -b $COOKIE -c $COOKIE -H "X-Requested-With: XMLHttpRequest" --data 
  "$DATA" http://192.168.8.1/api/sms/sms-list --header 
  "__RequestVerificationToken: $TOKEN" --header "Content-Type:text/xml"
  
  </code></pre>
  
  <p>what did i missed in python please?</p>