Exemple #1
0
 def doProcess(self, index, showInfo):
     try:
         mobile = Mobile()
         items = mobile.assemble(self._config.choiceDev(), int(self._config.getGlobal('count'))).__dict__
         items.update(self._config.choiceAct())
         data = package('password', json.dumps(items))
         http = Http(self._config.getGlobal('host'), self._config.getGlobal('port'))
         data = http.request(data)
         size = hex2int(data[36:44])
         body = data[44:45 + size]
         ret = None
         if showInfo:
             print 'start %s' % ("=" * 20)
             if ftype.isZIP(body):
                 ret = "BINARY"
                 print 'recv zip format data.'
             else:
                 ret = "TEXT"
                 print '%s' % ungzip(body)
             print 'End %s %s' % (index, "=" * 20)
         else: ret = body
     except:
         ret = None
     return ret
Exemple #2
0
def assemble(count):
    mobile = Mobile()
    items = mobile.assemble(config.choiceDev(), count).__dict__
    items.update(config.choiceAct())
    return json.dumps(items)