def writeHttpReqRspDataToFile(bsDict=None, reqHeaderData={}, reqBodyData={}, httpUrl=""): baseDictTranDataDict(bsDict) method = bsDict["method"] url = bsDict["url"] formatReqJsonFile = bsDict["formatReqJsonFile"] formatRspJsonFile = bsDict["formatRspJsonFile"] # os.mknod(formatReqJsonFile) # os.mknod(formatRspJsonFile) if method == "post": rsp = httpPost(url=httpUrl, headers=reqHeaderData, reqJsonData=reqBodyData) writeStrToJsonFile(filePath=formatReqJsonFile, jsonStr=reqBodyData, rwmode="a+") writeStrToJsonFile(filePath=formatRspJsonFile, jsonStr=rsp, rwmode="a+") elif method == "get": writeUrlLowDataToFile(filePath=formatReqJsonFile, jsonStr="top " + httpUrl) rsp = httpGet(url=httpUrl, headers=reqHeaderData) writeStrToJsonFile(filePath=formatRspJsonFile, jsonStr=rsp, rwmode="a+")
def queryHomePageCnf(self): self.rsp = httpGet(url=homeConfigQueryurl + self.reqjsondata, headers=self.jsonheart) return self.rsp
def queryActivity(self): queryResult = httpGet( url = searchActivityurl + self.reqjsondata, headers = self.jsonheart ) return queryResult
def getMemberIdByToken(self, token): urlSign = "/member/login/queryMemberInfo" rsp = httpGet(url=urldata[urlSign][2], headers={"token": token}) print("token memberId rsp %s" % rsp) return query_json(json_content=json.loads(rsp), query="data.memberId")
def userListCollectionReq(self): self.rsp = httpGet(url=userListCollectionUrl, headers=self.jsonheart) return self.rsp
def userStudentCourseList(self): self.rsp = httpGet(url=userStudentCourseListUrl, headers=self.jsonheart) return self.rsp
def queryOneActivity(self): self.rsp = httpGet(url=queryIdActivityurl + self.reqjsondata, headers=self.jsonheart) return self.rsp
def weixinUserSearchReq(self): self.rsp = httpGet(url=weixinSearchUrl + self.reqjsondata, headers=self.jsonheart) return self.rsp
def memberPersonalCenterReq(self): self.rsp = httpGet(url=memberPersonalCenterUrl, headers=self.jsonheart) return self.rsp
def userMemberIdReq(self): self.rsp = httpGet(url = weixinUserMemberIdUrl, headers = self.jsonheart) return self.rsp