title: Python read ussd response with GsmModem in human-readable string (en)
body: <p>i am using gsmmodem package, and trying to get response from USSD code which i am sending. USSD code execution works fine, but response is not in proper format (non-human readable) i want to get it in readable format.</p>
  
  <p>Please check code here</p>
  
  <pre><code>from __future__ import print_function
  import logging
  PORT = 'COM11'
  BAUDRATE = 921600
  USSD_STRING = '*111#'
  PIN = None # SIM card PIN (if any)
  
  from gsmmodem.modem import GsmModem
  
  def main():
      print('Initializing modem...')
      modem = GsmModem(PORT, BAUDRATE)
      modem.connect(PIN)
      modem.waitForNetworkCoverage(10)
      print('Sending USSD string: {0}'.format(USSD_STRING))
      response = modem.sendUssd(USSD_STRING) # response type: gsmmodem.modem.Ussd
      print('USSD reply received: {0}'.format(response.message))
      if response.sessionActive:
          print('Closing USSD session.')
          # At this point, you could also reply to the USSD message by using response.reply()
          response.cancel()
      else:
          print('USSD session was ended by network.')
      modem.close()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>Link for the code <a href="http://pastebin.com/SvYptykS" rel="nofollow">http://pastebin.com/SvYptykS</a></p>