def user_wechat_update_recover(self):
     url_token = "https://iot.wuliancloud.com:443/sso/login/byphone"  # 测试的接口url
     data = {
         "phone": "18168020465",
         "phoneCountryCode": "86",
         "password": "******",
         "terminalId": "a50b0fff867a8ab8f252bb65f321e6bb"
     }  # 接口数据
     headers = post_generate_headers(data)
     r = requests.post(url=url_token, json=data, headers=headers)  # 发送请求
     get_return = json.loads(r.text)
     global_value.set_get_return_value(get_return)
     csv_dict = Read_csv().read_csv()
     # 获取到的字符串格式数据转换成dict格式
     interface = json.loads(csv_dict["user/wechat/update_recover"],
                            encoding='utf-8')
     # 读取url的value
     url = get_serveraddress.get_serveraddress()[0] + interface["url"]
     # 读取url的data
     data = interface["data"]
     # 判断uId 和token 字符串
     if "uId" in data:
         data["uId"] = get_return["data"]['uId']
     # 读取url的data
     if "token" in data:
         data["token"] = get_return["data"]['token']
     get_headers = Post_headers(data)
     headers = get_headers.api_post_generate_headers(
         get_return["data"]['token'])
     r = requests.post(url=url, json=data, headers=headers)  # 发送请求
     postanswer = json.loads(r.text, encoding='utf-8')
     return postanswer["resultCode"]
示例#2
0
 def api_post_answer(self):
     get_return = iot_get_return()
     print(get_return)
     csv_dict = Read_csv().read_csv()
     # 获取到的字符串格式数据转换成dict格式
     interface = json.loads(csv_dict[self.key], encoding='utf-8')
     # 读取url的value
     url = get_serveraddress.get_serveraddress(
     )[adressIndex] + interface["url"]
     # 读取url的data
     data = interface["data"]
     # 判断uId 和token 字符串
     if "uId" in data:
         data["uId"] = get_return["data"]['uId']
     # 读取url的data
     if "token" in data:
         data["token"] = get_return["data"]['token']
     # if "unionId" in data:
     #     if data["unionId"]=="ovQgr0rNtJ03yV3bN9xlTjzQUM0":
     #         data["unionId"]="ovQgr0rNtJ03yV3bN9xlTjz"+publicMethod.randomMethod()
     get_headers = Post_headers(data)
     headers = get_headers.api_post_generate_headers(
         get_return["data"]['token'])
     r = requests.post(url=url, json=data, headers=headers)  # 发送请求
     postanswer = json.loads(r.text, encoding='utf-8')
     return postanswer
示例#3
0
 def sso_post_answer(self):
     csv_dict = Read_csv().read_csv()
     # 获取到的字符串格式数据转换成dict格式
     interface = json.loads(csv_dict[self.key], encoding='utf-8')
     # 读取url的value
     url = get_serveraddress.get_serveraddress(
     )[adressIndex] + interface["url"]
     # 读取url的data
     data = interface["data"]
     if global_value.get_execute_value() == "1":
         get_return = global_value.get_get_return_value()
         # 更改参数的data
         if "token" in data:
             data["token"] = get_return["data"]['token']
     get_headers = Post_headers(data)
     headers = get_headers.sso_post_generate_headers()
     r = requests.post(url=url, json=data, headers=headers)  # 发送请求
     print(r)
     postanswer = json.loads(r.text, encoding='utf-8')
     return postanswer
示例#4
0
 def iot_icampost_answer(self):
     get_return = iot_get_return()
     csv_dict = Read_csv().read_csv()
     # 获取到的字符串格式数据转换成dict格式
     interface = json.loads(csv_dict[self.key], encoding='utf-8')
     # 读取url的value
     url = get_serveraddress.get_serveraddress(
     )[adressIndex] + interface["url"]
     # 判断uId 和token 字符串
     if "uId" in url:
         url = url.replace("uId", get_return["data"]['uId'])
     # 读取url的data
     data = interface["data"]
     if "token" in data:
         data["token"] = get_return["data"]['token']
     get_headers = Post_headers(data)
     headers = get_headers.api_icampost_generate_headers()
     r = requests.post(url=url, json=data, headers=headers)  # 发送请求
     postanswer = json.loads(r.text, encoding='utf-8')
     return postanswer