Exemple #1
0
 def regBythirdAnswer(self):
     # 反序列化,将字符串转化为python格式
     interface = json.loads(self.dict[self.key], encoding="utf-8")
     url = serverAddress().getAddress()[adressIndex] + interface["url"]
     data = interface["data"]
     data["openId"] = "8005329582F41D11944FA953FB52" + randomMethod()
     return postRequest(url, data)
Exemple #2
0
 def ssoPostAnswer(self):
     # 反序列化,将字符串转化为python格式
     interface = json.loads(self.dict[self.key], encoding="utf-8")
     url = serverAddress().getAddress()[adressIndex] + interface["url"]
     data = interface["data"]
     getReturn = connectInterface().connect()
     print(getReturn)
     if "token" in data:
         data["token"] = getReturn["data"]["token"]
     hd = header.postHeader(data)
     r = requests.post(url=url, json=data, headers=hd)
     return json.loads(r.text, encoding="utf-8")
Exemple #3
0
 def apiGetAnswer(self):
     # 反序列化,将字符串转化为python格式
     interface = json.loads(self.dict[self.key], encoding="utf-8")
     url = serverAddress().getAddress()[adressIndex] + interface["url"]
     data = interface["data"]
     getReturn = connectInterface().connect()
     print(getReturn)
     if "token" in data:
         data["token"] = getReturn["data"]["token"]
     if "uId" in data:
         data["uId"] = getReturn["data"]['uId']
     getUrl = url + "?" + parse.urlencode(data, encoding="utf-8")
     getUrl = parse.unquote(getUrl)  # 解码  处理特殊字符
     print("getUrl:" + getUrl)
     hd = header.apiGetHeader(data, getReturn["data"]["token"])
     r = requests.get(url=getUrl, headers=hd)
     print(r.text)
     return json.loads(r.text, encoding="utf-8")