Exemplo n.º 1
0
 def select_borrowercode(self):
     """根据手机号查询sc_borrower.code"""
     # mobile = 18888884356
     use_json = UseJson("../data_config/get_mobile.json")
     mobile = use_json.read_data()
     str = "SELECT * FROM supplychain.`sc_borrower` WHERE mobile={}".format(
         mobile)
     result = self.select_db(str)
     code = result[0][1]  # 放回的是一个元组,通过下标访问元组
     use_json = UseJson("../data_config/borrowerCode.json")
     use_json.write_data({"borrowerCode": "{}".format(code)})
 def write_mobile(self):
     """写入 get_mobile.json 手机号码"""
     get_mobile = self.phone_code_generator()
     use_json = UseJson("../data_config/get_mobile.json")
     use_json.write_data(get_mobile)
Exemplo n.º 3
0
 def write_cookie(self):
     cookie = requests.utils.dict_from_cookiejar(self.get_cookie())
     usejson = UseJson()
     usejson.write_data(cookie)