Python error during Cloud connectivity

2 thoughts on “Python error during Cloud connectivity

  1. Dear Sir,

    We are developing remote monitoring device using GL868-DUAL module, Python interpreter and Telit cloud service.

    When we are sending data using Telit AT command controller, and docklite software, it works fine.

    But when we are implementing same AT command set in Python, We are getting following error.

    #########################################################################################

    #HTTPRING: 0,200,”text/plain; charset=utf-8″,112

    10:28:05.396 [RX] – AT#HTTPRCV=0

    <<<

    10:28:06.226 [RX] – {“success”:false,”errorMessages”:[“invalid character ‘A’ looking for beginning of value”],”errorCodes”:[-99999]}

    10:28:08.731 [RX] –
    OK

    ###############################################################################

    My Python data script is –

            data = ‘{“auth”:{ “command” : “api.authenticate”,”params” : {“appToken”: “gLQDWRJFtf1n90gK”,”appId”: “GL868_357804043273444”, “thingKey”:”357804043273444″ }}}’
            print data
            s =”
            while (s.find(‘OK’)==-1) :
                a = MDM.send(‘AT#HTTPSND=0,0,/api,150r’, 50)     # GPRS context activation
                b = MDM.receive(50)
                print b
                a = MDM.send(data, 100)
                s = MDM.receive(900)
                print s

            s =”
            while (s.find(‘#HTTPRING:’)==-1) :
                s = MDM.receive(500)
                print s
                
            s =”
            while (s.find(‘OK’)==-1) :
                a = MDM.send(‘AT#HTTPRCV=0r’, 50)     
                s = MDM.receive(200)
                print s

    Please let me know, if is issue.

    Regards

    Diwakar

    1. Hi,

      first of all I think you should improve your management of string literals and escape sequences.

      e.g.

      you can not write

      a = MDM.send(‘AT#HTTPRCV=0r’, 50)   ,

      but

      a = MDM.send(‘AT#HTTPRCV=0r’, 50) 

      And same considerations are valid for double quote characters (that can be present in the other commands).

      So my suggestion is:

      try to transform the syntax of the commands thay you successfully issued by Telti AT controller in Python commands, according to the syntax that you can see at this link:

      https://docs.python.org/release/1.5.2p1/ref/strings.html