Exemple #1
0
 def on_start(self):
     self.header = {
         "User-Agent":"Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; ALP-TL00 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 YunKuFang/1.3.3",
         "mobile-system":"android8.0.0",
         "app-type":"Android",
         "app-version":"1.3.3",
         "app-version-code":"13",
         "mobile-unid":"866215038845167",
         "mobile-type":"ALP-TL00",
         "Content-Type":"application/x-www-form-urlencoded",
         "Connection":"Keep-Alive"
     }
     self.loginRes = UserLogin(self).login(self.header)
     if self.loginRes:
         # print("self.loginRes===",self.loginRes)
         self.token = self.loginRes['data']['token']
         # print("登录成功----",self.loginRes)
         # print("token----",self.token)
         self.cxscClassObj = ChuangXinShiChang(self)
Exemple #2
0
class CXSCLiuCheng(TaskSet):
    def on_start(self):
        self.header = {
            "User-Agent":
            "Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; ALP-TL00 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 YunKuFang/1.3.3",
            "mobile-system": "android8.0.0",
            "app-type": "Android",
            "app-version": "1.3.3",
            "app-version-code": "13",
            "mobile-unid": "866215038845167",
            "mobile-type": "ALP-TL00",
            "Content-Type": "application/x-www-form-urlencoded",
            "Connection": "Keep-Alive"
        }
        self.loginRes = UserLogin(self).login(self.header)
        if self.loginRes:
            # print("self.loginRes===",self.loginRes)
            self.token = self.loginRes['data']['token']
            # print("登录成功----",self.loginRes)
            # print("token----",self.token)
            self.cxscClassObj = ChuangXinShiChang(self)
        # events.init_command_line_parser()
        # spawned.wait() #在此设置了集合点

    @task
    def liuCheng(self):

        if self.loginRes:
            cxsc_list = self.cxscClassObj.cxsc_list(self.token,
                                                    self.header)  #创新市场列表
            if cxsc_list:
                detailObj = random.choice(cxsc_list["data"]["list"])
                objId = detailObj["id"]
                # objId = "b934b31641e58338da634a0fe45e1987"
                cxsc_detail = self.cxscClassObj.cxsc_detail(
                    objId, self.token, self.header)  #创新市场项目详情
                if cxsc_detail:
                    ququerenOBJ = self.cxscClassObj.quRenGou(
                        cxsc_detail, self.token, self.header)  #创新市场去认购
                    if ququerenOBJ:
                        rengou = self.cxscClassObj.renGou(
                            ququerenOBJ, cxsc_detail['data']['id'], self.token,
                            self.header)