Пример #1
0
    def comAndHuoQuTask(self, user_dict, apikey, header):
        """"
        获取任务
        
        """
        rw_url = "v2/user/card-status"
        renwu_data = {
            "access_token": user_dict["access_token"],
            "timestamp": str(int(time.time())),
            "sign": ""
        }
        sign = GetDataSign().sign_body(rw_url, renwu_data, apikey)
        renwu_data["sign"] = sign
        #进入获取任务页面请求
        renwu_res = PublicRequest(self).requestMethod(rw_url, renwu_data,
                                                      header)
        if not renwu_res:
            renwu_res = None
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                rw_url, renwu_data, renwu_res))
            # response.failure("报错url==={} ,参数==={} ,报错原因==={}".format(rw_url,renwu_data,renwu_res))
        else:
            PublicRequest(self).requestMethod(rw_url, renwu_data, header)

        return renwu_res
Пример #2
0
 def selectGoldShares(self,apikey,header,login_res):
     """"
     查询金股余额
     
     """
     xzc_url = "v2/wallet/new-assets"
     xzc_data = {
         "access_token":login_res["access_token"],
         "timestamp":str(int(time.time())),
         "sign":	""
     }
     sign = GetDataSign().sign_body(xzc_url,xzc_data, apikey)
     xzc_data["sign"] = sign
     #获取资产
     xzc_respons = PublicRequest(self).requestMethod(xzc_url,xzc_data,header)
     xzsres = json.loads(xzc_respons.text)
     if 'status' in xzsres and xzsres["status"] == 200 or xzsres["status"] == "200":
         time.sleep(random.randint(1,3))
         xzc_respons.success()
         goldShares = xzsres["data"]
         thighs_int = int(goldShares["thighs"]) #金股数量
         usdt_int = int(goldShares["usdt"])  #aic数量
         print("金股数量===={},aic数量======{}".format(thighs_int,usdt_int))
         if thighs_int > 7:
             print("11111")
             return True
         xcsl = 7 - thighs_int 
         if int(usdt_int/1000) > xcsl:
             print("2222")
         # 把aic兑换成金股
             self.exchangeGoldShares(apikey,header,login_res,xcsl+1)
             return True
         else:
             print("====金股余额不足,并且aic余额也不足===={}".format(login_res))
Пример #3
0
    def login(self, apikey, header):
        """"
        登录》获取首页》判断密保(未设置密保先设置密保)》判断是否实名(未实名则先实名)
        
        """
        try:
            mobile = self.user.queueData.get()  #获取队列里的数据
        except queue.Empty:  #队列取空后,直接退出
            print('no data exist')
            exit(0)
        password = "******"  #
        device_tokens = int(
            round(time.time() *
                  1000))  #"AkWsVNSPMcwhC6nAXITHbPyrv0YgG5nt1T0B8n79-lrN"
        self.login_data = {
            "password": "******",
            "latitude": "39.905662",
            "mobile": "18810798467",
            "long": "116.64063",
            "device_tokens": "",
            "timestamp": str(int(time.time())),
            "sign": ""
        }
        login_url = "v2/login/login2"
        sign = GetDataSign().sign_body(login_url, self.login_data, apikey)
        print("sign====", sign)
        self.login_data["sign"] = sign

        #登录
        loginres = PublicRequest(self).requestMethod(login_url,
                                                     self.login_data, header)
        print("登录===={}".format(loginres.elapsed.total_seconds()))
        loginresult = json.loads(loginres.text)
        if 'status' in loginresult and loginresult[
                "status"] == 200 or 'status' in loginresult and loginresult[
                    "status"] == "200":
            time.sleep(random.randint(1, 3))
            login_res = loginresult["data"]
            loginres.success()
            return login_res
        elif 'status' in loginresult and loginresult[
                "status"] == 421:  #登录设备发生改变
            # loginres.success()
            time.sleep(random.randint(1, 3))
            login_res = self.miBaoWenTi(apikey, header)
            return login_res
        elif 'status' in loginresult and loginresult["status"] == 412:
            print("请打开应用权限")
            loginres.failure("XXX{}---{}XXX===={}".format(
                str(mobile), password))
        elif 'status' in loginresult and loginresult["status"] == 1006:
            print("用户名或密码错误")
            loginres.failure("XXX{}---{}XXX===={}".format(
                str(mobile), password))
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                login_url, self.login_data, loginresult))
            loginres.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                login_url, self.login_data, loginresult))
Пример #4
0
    def zhuceUser(self,apikey,header):
        try:
            mobile = self.locust.queueData.get()  #获取队列里的数据
        except queue.Empty:                     #队列取空后,直接退出
            print('no data exist')
            exit(0)
        zc_data = {
            "password":"******",
            "latitude":"39.905662",
            "mobile":str(mobile),
            "long":"116.64063",
            "device_tokens":"",
            "timestamp":str(int(time.time())),
            "sign":	"" 
        }

        zc_url = "v2/login/signup"
        sign = GetDataSign().sign_body(zc_url,zc_data, apikey)
        zc_data["sign"] = sign
        # print("zc_data===={}".format(zc_data))
        zc_respons = PublicRequest(self).requestMethod(zc_url,zc_data,header)
        print("注册===={}".format(zc_respons.elapsed.total_seconds()))
        zcres = json.loads(zc_respons.text)
        print("zc_res===={}".format(zcres))
        if 'status' in zcres and zcres["status"] == 200 or zcres["status"] == "200":
            time.sleep(random.randint(1,3))
            zc_respons.success()
            return zcres["data"]
        elif 'status' in zcres and zcres["status"] == 422 or zcres["status"] == "422":
            print("此手机号已注册==={}".format(str(mobile)))
            zc_respons.success()
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(zc_url,zc_data,zcres))
            zc_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(zc_url,zc_data,zcres))
Пример #5
0
 def userLogout(self, apikey, header, login_res):
     logout_url = "v2/login/logout"
     logout_urlName = "用户退出"
     logout_data = {
         "access_token": login_res["access_token"],
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     sign = GetDataSign().sign_body(logout_url, logout_data, apikey)
     logout_data["sign"] = sign
     return PublicRequest(self).publicRequest(logout_url, logout_urlName,
                                              logout_data, header)
Пример #6
0
    def zhuCeAndlogin(self, apikey, header, mobile):
        """"
        登录
        
        """
        password = "******"  #"e10adc3949ba59abbe56e057f20f883e" #
        device_tokens = ""  #"AkWsVNSPMcwhC6nAXITHbPyrv0YgG5nt1T0B8n79-lrN"
        login_data = {
            "password": password,
            "latitude": "39.905662",
            "mobile": str(mobile),
            "long": "116.64063",
            "device_tokens": device_tokens,
            "timestamp": str(int(time.time())),
            "sign": ""
        }
        url = "v2/login/login-new"
        sign = GetDataSign().sign_body(url, login_data, apikey)
        login_data["sign"] = sign

        #登录
        loginres = PublicRequest(self).requestMethod(url, login_data, header)
        loginresult = json.loads(loginres.text)
        if 'status' in loginresult and loginresult[
                "status"] == 200 or 'status' in loginresult and loginresult[
                    "status"] == "200":
            time.sleep(random.randint(1, 3))
            login_res = loginresult["data"]
            loginres.success()
            return login_res
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                url, login_data, loginresult))
            loginres.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                url, login_data, loginresult))
Пример #7
0
 def getUserType(self,apikey,header,login_res):
     """"
     获取实名认证的状态
     
     """
     rw_url = "v2/user/card-status"
     renwu_data = {
         "access_token":login_res["access_token"],
         "timestamp":str(int(time.time())),
         "sign":	""
     }
     sign = GetDataSign().sign_body(rw_url,renwu_data, apikey)
     renwu_data["sign"] = sign
     #进入获取任务页面请求
     renwu_respons = PublicRequest(self).requestMethod(rw_url,renwu_data,header)
     zfrwres = json.loads(renwu_respons.text)
     if 'status' in zfrwres and zfrwres["status"] == 200 or zfrwres["status"] == "200":
         time.sleep(random.randint(1,3))
         renwu_respons.success()
         return zfrwres["data"]
     elif 'status' in zfrwres and zfrwres["status"] == 401 or zfrwres["status"] == "401":
         print("未登录或已退出")
         # self.interrupt(reschedule=True)
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(rw_url,renwu_data,zfrwres))
         renwu_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(rw_url,renwu_data,zfrwres))
Пример #8
0
 def setPaymentPassword(self, apikey, header, login_res):
     """"
     设置支付密码
     
     """
     setzfmm_url = "v2/wallet/set-paypwd"
     setzfmm_data = {
         "access_token": login_res["access_token"],
         "password": "******",
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     sign = GetDataSign().sign_body(setzfmm_url, setzfmm_data, apikey)
     setzfmm_data["sign"] = sign
     #设置交易密码
     setzfmm_respons = PublicRequest(self).requestMethod(
         setzfmm_url, setzfmm_data, header)
     print("设置密码===={}".format(setzfmm_respons.elapsed.total_seconds()))
     setzfmmres = json.loads(setzfmm_respons.text)
     print("设置交易密码结果====={}".format(setzfmmres))
     if 'status' in setzfmmres and setzfmmres[
             "status"] == 200 or 'status' in setzfmmres and setzfmmres[
                 "status"] == "200":
         time.sleep(random.randint(1, 3))
         setzfmm_respons.success()
         return setzfmmres
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(
             setzfmm_url, setzfmm_data, setzfmmres))
         setzfmm_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
             setzfmm_url, setzfmm_data, setzfmmres))
Пример #9
0
 def comTask(self, apikey, header, login_res, dqid):
     """"
     进入申请任务页
     
     """
     jrhqy_url = "v2/new-year20/actindex"
     jrhqy_data = {
         "access_token": login_res["access_token"],
         "periodId": dqid,
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     jrhqy_data["sign"] = GetDataSign().sign_body(jrhqy_url, jrhqy_data,
                                                  apikey)
     jrhqy_respons = PublicRequest(self).requestMethod(
         jrhqy_url, jrhqy_data, header)
     jrhqyres = json.loads(jrhqy_respons.text)
     if 'status' in jrhqyres and jrhqyres[
             "status"] == 200 or 'status' in jrhqyres and jrhqyres[
                 "status"] == "200":
         time.sleep(random.randint(1, 3))
         jrhqy_respons.success()
         return jrhqyres
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(
             jrhqy_url, jrhqy_data, jrhqyres))
         jrhqy_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
             jrhqy_url, jrhqy_data, jrhqyres))
Пример #10
0
 def setMiBao(self, apikey, header, login_res, is_safe):
     # 设置密保
     print("is_safe[data]==={}".format(is_safe))
     if is_safe["data"]["is_safe"] == "0":
         mibao_url = "v2/safe/set-safe-issue"
         mibao_data = {
             "access_token": login_res["access_token"],
             "answer":
             "W3siYW5zd2VyIjoi5YyX5LqsIiwiaXNfc3lzIjoiMCIsImlzc3VlIjoiMSJ9LHsiYW5zd2VyIjoi5YyX5LqsIiwiaXNfc3lzIjoiMCIsImlzc3VlIjoiMyJ9LHsiYW5zd2VyIjoi5YyX5LqsIiwiaXNfc3lzIjoiMSIsImlzc3VlIjoi5YyX5LqsIn1d",
             "timestamp": str(int(time.time())),
             "sign": ""
         }
         # 提交设置的密保
         mibao_data["sign"] = GetDataSign().sign_body(
             mibao_url, mibao_data, apikey)
         mibao_respons = PublicRequest(self).requestMethod(
             mibao_url, mibao_data, header)
         mibaores = json.loads(mibao_respons.text)
         if 'status' in mibaores and mibaores[
                 "status"] == 200 or 'status' in mibaores and mibaores[
                     "status"] == "200":
             time.sleep(random.randint(1, 3))
             mibao_respons.success()
             return mibaores
         else:
             print("报错url==={} ,参数==={} ,报错原因==={}".format(
                 mibao_url, mibao_data, mibaores))
             mibao_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                 mibao_url, mibao_data, mibaores))
Пример #11
0
 def getDangQiId(self, apikey, header, login_res):
     """"
     获取当期id
     """
     dq_url = "v2/new-year20/online-period"
     dq_data = {
         "access_token": login_res["access_token"],
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     dq_data["sign"] = GetDataSign().sign_body(dq_url, dq_data, apikey)
     jrhqy_respons = PublicRequest(self).requestMethod(
         dq_url, dq_data, header)
     dqres = json.loads(jrhqy_respons.text)
     if 'status' in dqres and dqres[
             "status"] == 200 or 'status' in dqres and dqres[
                 "status"] == "200":
         time.sleep(random.randint(1, 3))
         jrhqy_respons.success()
         return dqres["data"]
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(
             dq_url, dq_data, dqres))
         jrhqy_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
             dq_url, dq_data, dqres))
Пример #12
0
    def miBaoWenTi(self, apikey, header):
        """
        # 登录设备发生改变,回答密保问题
        """
        daan_url = "v2/safe/answer"
        daan_data = {
            "password": self.login_data["password"],
            "question": "1",
            "answer": "北京",
            "latitude": self.login_data["latitude"],
            "mobile": self.login_data["mobile"],
            "long": self.login_data["long"],
            "device_tokens": self.login_data["device_tokens"],
            "timestamp": self.login_data["timestamp"],
            "sign": ""
        }

        # 获取首页
        daan_data["sign"] = GetDataSign().sign_body(daan_url, daan_data,
                                                    apikey)
        daan_respons = PublicRequest(self).requestMethod(
            daan_url, daan_data, header)
        daanres = json.loads(daan_respons.text)
        if 'status' in daanres and daanres["status"] == 200:
            time.sleep(random.randint(1, 3))
            daan_respons.success()
            return daanres["data"]
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                daan_url, daan_data, daanres))
            daan_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                daan_url, daan_data, daanres))
Пример #13
0
 def index(self, apikey, header, login_res):
     # 获取首页的参数
     if login_res:
         index_url = "v2/my/index"
         index_data = {
             "access_token": login_res["access_token"],
             "sign": "",
             "timestamp": str(int(time.time()))
         }
         # 获取首页
         index_data["sign"] = GetDataSign().sign_body(
             index_url, index_data, apikey)
         sy_respons = PublicRequest(self).requestMethod(
             index_url, index_data, header)
         syres = json.loads(sy_respons.text)
         if 'status' in syres and syres[
                 "status"] == 200 or 'status' in syres and syres[
                     "status"] == "200":
             time.sleep(random.randint(1, 3))
             sy_respons.success()
             return syres
         else:
             print("报错url==={} ,参数==={} ,报错原因==={}".format(
                 index_url, index_data, syres))
             sy_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                 index_url, index_data, syres))
Пример #14
0
 def queryPaymentPassword(self, apikey, header, login_res):
     """"
     查询用户是否设置了支付密码
     
     """
     cxzfmm_url = "v2/wallet/trade-wallet"
     cxzfmm_data = {
         "access_token": login_res["access_token"],
         "paypwd": "e10adc3949ba59abbe56e057f20f883e",
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     # print("设置密码data====={}")
     sign = GetDataSign().sign_body(cxzfmm_url, cxzfmm_data, apikey)
     cxzfmm_data["sign"] = sign
     # print("sigin ======= {}".format(setzfmm_data["sign"]))
     #设置交易密码
     cxzfmm_respons = PublicRequest(self).requestMethod(
         cxzfmm_url, cxzfmm_data, header)
     cxzfmmres = json.loads(cxzfmm_respons.text)
     # print("查询交易密码结果====={}".format(cxzfmmres))
     if 'status' in cxzfmmres and cxzfmmres[
             "status"] == 200 or 'status' in cxzfmmres and cxzfmmres[
                 "status"] == "200":
         time.sleep(random.randint(1, 3))
         cxzfmm_respons.success()
         return cxzfmmres["data"]["userWallet"]
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(
             cxzfmm_url, cxzfmm_data, cxzfmmres))
         cxzfmm_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
             cxzfmm_url, cxzfmm_data, cxzfmmres))
Пример #15
0
    def exchangeGoldShares(self, apikey, header, login_res, num):
        """"
        兑换金股
        
        """
        dhjg_url = "v2/thigh/exchange-more"
        dhjg_data = {
            "access_token": login_res["access_token"],
            "num": str(num),  #兑换金股的数量
            "paypwd": "e10adc3949ba59abbe56e057f20f883e",
            "timestamp": str(int(time.time())),
            "sign": ""
        }
        sign = GetDataSign().sign_body(dhjg_url, dhjg_data, apikey)
        dhjg_data["sign"] = sign
        #先查询用户是否有交易密码

        #兑换金股
        dh_respons = PublicRequest(self).requestMethod(dhjg_url, dhjg_data,
                                                       header)
        print("兑换金股===={}".format(dh_respons.elapsed.total_seconds()))
        dhres = json.loads(dh_respons.text)
        if 'status' in dhres and dhres[
                "status"] == 200 or 'status' in dhres and dhres[
                    "status"] == "200":
            time.sleep(random.randint(1, 3))
            dh_respons.success()
            return "200"
        elif 'status' in dhres and dhres[
                "status"] == 402 or 'status' in dhres and dhres[
                    "status"] == "402":
            dh_respons.success()
            print("未设置密码")
            return "402"
            # if self.setPaymentPassword():
            #     print("已设置密码")
            #     dh_respons = PublicRequest(self).requestMethod(dhjg_url,dhjg_data,header)
            #     dhres = json.loads(dh_respons.text)
            #     if 'status' in dhres and dhres["status"] == 200 or 'status' in dhres and dhres["status"] == "200":
            #         time.sleep(random.randint(1,3))
            #         print("兑换金股成功")
            #         dh_respons.success()
            #         return dhres
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                dhjg_url, dhjg_data, dhres))
            dh_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                dhjg_url, dhjg_data, dhres))
Пример #16
0
 def message(self, apikey, header, login_res):
     xxurl = "/v2/friends-apply/list"
     xxurlName = "好友请求待验证列表"
     xxdata = {
         "access_token": login_res["access_token"],
         "page": "1",
         "sign": "",
         "timestamp": str(int(time.time()))
     }
     sign = GetDataSign().sign_body(xxurl, xxdata, apikey)
     xxdata["sign"] = sign
     tjhylist_respons = PublicRequest(self).publicRequest(
         xxurl, xxurlName, xxdata, header)
     if tjhylist_respons:
         return tjhylist_respons["data"]["list"]
Пример #17
0
 def addFriends(self, apikey, header, login_res, mobile):
     """"
     查找好友uid
     """
     czhyurl = "/v2/friends/open-user"
     czhyurlName = "查找好友"
     czhyData = {
         "access_token": login_res["access_token"],
         "sign": "",
         "timestamp": str(int(time.time())),
         "username": str(mobile)
     }
     sign = GetDataSign().sign_body(czhyurl, czhyData, apikey)
     czhyData["sign"] = sign
     czhylist_respons = PublicRequest(self).publicRequest(
         czhyurl, czhyurlName, czhyData, header)
     if czhylist_respons:
         return czhylist_respons["data"]["uid"]
Пример #18
0
 def main_entrance(self):
     """"
     进入获取任务页
     
     """
     url = "v2/new-year20/online-period"
     canshu_data = {
         "access_token": self.user_dict["access_token"],
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     # print("userDict======={}".format(canshu_data),)
     sign = GetDataSign().sign_body(url, canshu_data, self.apikey)
     canshu_data["sign"] = sign
     #进入获取任务页面
     hqrw_res = PublicRequest(self).requestMethod(url, canshu_data,
                                                  self.header)
     return hqrw_res
Пример #19
0
 def getUserDetail(self, apikey, header, login_res, uid):
     """"
     根据uid查看用户详情
     """
     xq_url = "/v2/friends/id-user"
     xq_urlName = "根据uid查看用户详情"
     xq_data = {
         "access_token": login_res["access_token"],
         "sign": "",
         "timestamp": str(int(time.time())),
         "username": str(mobile)
     }
     sign = GetDataSign().sign_body(xq_url, xq_data, apikey)
     xq_data["sign"] = sign
     xqlist_respons = PublicRequest(self).publicRequest(
         xq_url, xq_urlName, xq_data, header)
     if xqlist_respons:
         return xqlist_respons["data"]
Пример #20
0
 def openRedEnvelopes(self, apikey, header, login_res, gift_id, group_id):
     """
     打开红包
     """
     openlist_url = "/v2/gift/receive"
     openlist_urlName = "打开红包"
     openlist_data = {
         "access_token": login_res["access_token"],
         "gift_id": gift_id,
         "group_id": group_id,
         "sign": "",
         "timestamp": str(int(time.time()))
     }
     sign = GetDataSign().sign_body(openlist_url, openlist_data, apikey)
     openlist_data["sign"] = sign
     openlist_respons = PublicRequest(self).publicRequest(
         openlist_url, openlist_urlName, openlist_data, header)
     return openlist_respons
Пример #21
0
 def robRedEnvelopes(self, apikey, header, login_res, gift_id):
     """
     抢红包
     """
     roblist_url = "/v2/gift/giftinfo"
     roblist_urlName = "抢红包"
     roblist_data = {
         "access_token": login_res["access_token"],
         "gift_id": gift_id,
         "sign": "",
         "timestamp": str(int(time.time()))
     }
     sign = GetDataSign().sign_body(roblist_url, roblist_data, apikey)
     roblist_data["sign"] = sign
     roblist_respons = PublicRequest(self).publicRequest(
         roblist_url, roblist_urlName, roblist_data, header)
     if roblist_respons:
         return roblist_respons["data"]["info"]
Пример #22
0
 def pengYou(self, apikey, header, login_res):
     """
     进入朋友模块》聊天记录列表
     """
     pylist_url = "/v2/group/my-group-list"
     pylist_urlName = "朋友模块列表"
     pylist_data = {
         "access_token": login_res["access_token"],
         "page": 1,
         "sign": "",
         "timestamp": str(int(time.time())),
         "type": 3
     }
     sign = GetDataSign().sign_body(pylist_url, pylist_data, apikey)
     pylist_data["sign"] = sign
     pylist_respons = PublicRequest(self).publicRequest(
         pylist_url, pylist_urlName, pylist_data, header)
     if pylist_respons:
         return pylist_respons["data"]["list"]
Пример #23
0
 def getInfo(self, apikey, header, login_res, group_id):
     """
     进入朋友或群的聊天页
     return 群成员list
     """
     infolist_url = "/v2/group/member-list"
     infolist_urlName = "进入朋友或群的聊天页"
     infolist_data = {
         "access_token": login_res["access_token"],
         "group_id": group_id,
         "sign": "",
         "timestamp": str(int(time.time()))
     }
     sign = GetDataSign().sign_body(infolist_url, infolist_data, apikey)
     infolist_data["sign"] = sign
     infolist_respons = PublicRequest(self).publicRequest(
         infolist_url, infolist_urlName, infolist_data, header)
     if infolist_respons:
         return infolist_respons["data"]
Пример #24
0
 def passValidation(self, apikey, header, login_res, id):
     """
     通过添加好友的验证
     """
     tgyz_url = "/v2/friends-apply/set-friend"
     tgyz_urlName = "通过添加好友的验证"
     tgyz_data = {
         "access_token": login_res["access_token"],
         "id": id,
         "sign": "",
         "status": "1",
         "timestamp": str(int(time.time()))
     }
     sign = GetDataSign().sign_body(tgyz_url, tgyz_data, apikey)
     tgyz_data["sign"] = sign
     tgyzlist_respons = PublicRequest(self).publicRequest(
         tgyz_url, tgyz_urlName, tgyz_data, header)
     if tgyzlist_respons:
         return tgyzlist_respons["status"]
Пример #25
0
    def getUserType(self, apikey, header, login_res):
        """"
        获取实名认证的状态
        
        """
        rw_url = "v2/user/card-status"
        renwu_data = {
            "access_token": login_res["access_token"],
            "timestamp": str(int(time.time())),
            "sign": ""
        }
        sign = GetDataSign().sign_body(rw_url, renwu_data, apikey)
        renwu_data["sign"] = sign
        #进入获取任务页面请求
        sfzpath = "E:/myTestFile/TestObject/TongChuangYuanMa/yunqianbao/static/shenfenzheng.txt"
        renwu_respons = PublicRequest(self).requestMethod(
            rw_url, renwu_data, header)
        zfrwres = json.loads(renwu_respons.text)
        if 'status' in zfrwres and zfrwres["status"] == 200 or zfrwres[
                "status"] == "200":
            time.sleep(random.randint(1, 3))
            renwu_respons.success()
            taskdata = zfrwres["data"]["type"]
            if taskdata == 5:
                # print("{}用户状态==={}===已实名通过".format(login_res["mobile"],taskdata))
                return taskdata
            elif taskdata == 3:
                print("{}用户状态==={}===待审核".format(login_res["mobile"],
                                                 taskdata))
            elif taskdata == 1:
                print("{}用户状态==={}===未实名,现在去提交审核资料".format(
                    login_res["mobile"], taskdata))
                self.shiMing(apikey, header, login_res, sfzpath)  #实名认证
                print("{}用户提交了审核资料=={}".format(login_res["mobile"], taskdata))
            elif taskdata == 2:
                print("{}用户状态=={}==未实名,现在去提交审核资料".format(
                    login_res["mobile"], taskdata))
                self.shiMing(apikey, header, login_res, sfzpath)  #实名认证
            else:
                print("{}用户状态=={}".format(login_res["mobile"], taskdata))

        elif 'status' in zfrwres and zfrwres["status"] == 401 or zfrwres[
                "status"] == "401":
            print("未登录或已退出")
            # self.interrupt(reschedule=True)
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                rw_url, renwu_data, zfrwres))
            renwu_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                rw_url, renwu_data, zfrwres))
Пример #26
0
 def getUserDetail(self, apikey, header, login_res, uid):
     """"
     根据uid添加对方为好友
     """
     tjhy_url = "/v2/friends-apply/applyfor"
     tjhy_urlName = "根据uid添加对方为好友"
     tjhy_data = {
         "access_token": login_res["access_token"],
         "message": "你好",
         "sign": "",
         "timestamp": str(int(time.time())),
         "uid": uid
     }
     sign = GetDataSign().sign_body(tjhy_url, tjhy_data, apikey)
     tjhy_data["sign"] = sign
     tjhylist_respons = PublicRequest(self).publicRequest(
         tjhy_url, tjhy_urlName, tjhy_data, header)
     # print("tjhylist_respons====",tjhylist_respons)
     if tjhylist_respons:
         return tjhylist_respons["status"]
Пример #27
0
 def huoQuTask(self):
     """"
     获取任务
     
     """
     rw_url = "v2/user/card-status"
     renwu_data = {
         "access_token": self.user_dict["access_token"],
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     sign = GetDataSign().sign_body(rw_url, renwu_data, self.apikey)
     renwu_data["sign"] = sign
     #进入获取任务页面
     renwu_res = PublicRequest(self).requestMethod(rw_url, renwu_data,
                                                   self.header)
     if not renwu_res:
         print("XXXXXXXXXXXXXX获取任务失败,您未实名或实名信息在审核中XXXXXXXXXXXXX{}".format(
             renwu_res))
     return renwu_res
Пример #28
0
    def shiMing(self,apikey,header,login_res,sfz_path):
        # 实名认证
        if login_res["info"]["idcard"] == None:
            card = WriteAndReadTextFile().readAndRemoveOneLine(sfz_path)
            print("实名人员====={}".format(card))
            if card: 
                card_list = card.split(" ")
                shiming_url = "v2/card/user-real-name"
                fields = {
                    "access_token":login_res["access_token"],
                    "idcard":card_list[1], #身份证号码
                    "degree":"0",
                    "sign":"",
                    "realname":card_list[0], #用户姓名
                    "timestamp":str(int(time.time())),
                    "image_face":('tp1.jpg',open("F:/myTestFile/TestObject/YouTime/yunqianbao/img/tp1.jpg", "rb"),"multipart/form-data"), #脸部照片
                    "image_con":('tp2.jpg',open("F:/myTestFile/TestObject/YouTime/yunqianbao/img/tp2.jpg", "rb"),"multipart/form-data"), #背面照片
                    "image_hand":('tp3.jpg',open("F:/myTestFile/TestObject/YouTime/yunqianbao/img/tp3.jpg", "rb"),"multipart/form-data") #手持正面照片 
                }
                # # 实名
                sign = GetDataSign().sign_body(shiming_url,fields, apikey)
                fields["sign"] = sign
                m = MultipartEncoder(fields)
                header['Content-Type'] = m.content_type
                # header['Content-Type'] = m.content_type
                sm_respons = PublicRequest(self).requestMethod(shiming_url,m,header)
                print("Content-Type-1======{}".format(header['Content-Type']))

                header['Content-Type'] = "application/x-www-form-urlencoded"

                print("Content-Type-2======{}".format(header['Content-Type']))
                smres = json.loads(sm_respons.text)
                if 'status' in smres and smres["status"] == 200 or 'status' in smres and smres["status"] == "200":
                    time.sleep(random.randint(1,3))
                    sm_respons.success()
                    # print("Content-Type-1======{}".format(header['Content-Type']))
                    # header['Content-Type'] = "application/x-www-form-urlencoded"
                    # print("Content-Type-2======{}".format(header['Content-Type']))
                    return smres
                else:
                    print("报错url==={} ,参数==={} ,报错原因==={}".format(shiming_url,m,smres))
                    sm_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(shiming_url,m,smres))
            else:
                print("XXX没有实名的身份证号了XXX")
                # self.interrupt(reschedule=True)
        else:
            print("zhi shi====={}".format(login_res["info"]))
Пример #29
0
 def hairRedEnvelopes(self, apikey, header, login_res, group_id):
     """
     发红包
     """
     hair_url = "/v2/gift/give"
     hair_urlName = "发红包"
     aics = random.randint(1, 50)
     hair_data = {
         "access_token": login_res["access_token"],
         "pay_pwd": "e10adc3949ba59abbe56e057f20f883e",
         "group_id": group_id,
         "aics": str(aics),
         "title": "恭喜发财,大吉大利",
         "nums": str(random.randint(1, aics)),
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     sign = GetDataSign().sign_body(hair_url, hair_data, apikey)
     hair_data["sign"] = sign
     hair_respons = PublicRequest(self).publicRequest(
         hair_url, hair_urlName, hair_data, header)
     if hair_respons and hair_respons["status"] == 200:
         print("发红包成功,红包id是:{}".format(hair_respons["data"]["gift_id"]))
         return hair_respons["data"]["gift_id"]
Пример #30
0
 def userLogout(self,apikey,header,login_res):
     logout_url = "v2/login/logout"
     logout_data = {
         "access_token":login_res["access_token"],
         "timestamp":str(int(time.time())),
         "sign":""
     }
     
     sign = GetDataSign().sign_body(logout_url,logout_data, apikey)
     logout_data["sign"] = sign
     out_respons = PublicRequest(self).requestMethod(logout_url,logout_data,header)
     outres = json.loads(out_respons.text)
     if 'status' in outres and outres["status"] == 200 or outres["status"] == "200":
         time.sleep(random.randint(1,3))
         out_respons.success()
         return outres
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(logout_url,logout_data,outres))
         out_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(logout_url,logout_data,outres))