def on_start(self): self.token = "72465872a0ff482784a8985615792f4f" #desKey = "" self.test_data = "version=1.0.0&deviceNo=72465872a0ff482784a8985615792f4f&deviceType=2&cityId=51010000&data={\"account\":\"admin\",\"password\":\"123456\",\"type\":\"1\"}" encrypt.initSdk(self.token) self.deskey = encrypt.getToken()
buf = StringIO.StringIO() curl.setopt(pycurl.SSL_VERIFYPEER,False) curl.setopt(pycurl.HTTPHEADER,head) curl.setopt(pycurl.POSTFIELDS,urllib.urlencode(data)) curl.setopt(pycurl.WRITEFUNCTION,buf.write) curl.setopt(pycurl.URL, url) curl.setopt(pycurl.CUSTOMREQUEST,"POST") curl.perform() the_page=buf.getvalue() buf.close() return the_page #deskey = '' token ="72465872a0ff482784a8985615792f4f" encrypt.initSdk(token) deskey=encrypt.getToken() #test_url2="http://192.168.10.115:8084/house/get" test_url1 = "http://test.passport.maifangma.com/login" test_data1= "version=1.0.0&deviceNo=72465872a0ff482784a8985615792f4f&deviceType=2&cityId=51010000&data={\"account\":\"admin\",\"password\":\"123456\",\"type\":\"1\"}" signature=encrypt.signature(test_data1, deskey) def login(): #deskey = '' #token ="72465872a0ff482784a8985615792f4f" #encrypt.initSdk(token) #deskey=encrypt.getToken() c = pycurl.Curl() #test_url2="http://192.168.10.115:8084/house/get" #test_url1 = "http://test.passport.maifangma.com/login"
def on_start(self): encrypt.initSdk(self.token) self.desKey = encrypt.getToken() self.ticketId = self.login(user='******',password='******')