国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python:接口間數據傳遞與調用方法

2020-02-16 00:10:05
字體:
來源:轉載
供稿:網友

如下所示:

import requestsimport unittestimport jsonfrom pubulic_way.get_token import getSession class testlogin(unittest.TestCase):   def test_getIdentify(self):    '''調用test_listCollectInfoByCreditId(self)響應數據中的taxid參數'''    result = self.get_listCollectInfoByCreditId()    json_result=json.loads(result)    p1 = json_result["polygons"][0]["ENTERPRISETAXID"]    data = {"lyname":"COL_WPOLYGON_3206","id":"8f34969c-ea5e-489c-94bc-37e54ad40660","taxid":p1}    url = "http://10.17.17.31:8080/LandTaxSys/search/getLayerAlianame"    headers = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}    cookies = self.get_cookies()    r = requests.post(url,data=data,headers=headers,cookies=cookies)    # print(p1)    # print(r.status_code)    # print(r.text)    # return r.text    checkpoint = '91320612MA1UYCL59U'    if r.status_code == 200:      if checkpoint in r.text:        print('測試結果:Passed,斷言成功。響應狀態碼:{}。響應數據【json】:{}'.format(r.status_code,r.text))      else:        print('測試結果:Failed,斷言失敗。響應狀態碼:{}。斷言內容為:{}。響應數據【json】:{}'.format(r.status_code,checkpoint,r.text))    else:      print('測試結果:Failed,接口不通。響應狀態碼:{}。響應數據【json】:{}'.format(r.status_code,r.text))   def get_listCollectInfoByCreditId(self):    '''獲取響應數據中的taxid參數'''    url = "http://10.17.17.31:8080/LandTaxSys/dataEdit/listCollectInfoByCreditId"    data = {"start":"1","end":"8","targetTaxId":"91320612MA1UYCL59U","nearbyTaxId":"","swjgDm":"23206","userId":"32060100033"}    headers = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}    cookies = self.get_cookies()    r = requests.post(url,data=data,headers=headers,cookies=cookies)    return r.text   def get_cookies(self):    cookies = getSession()    return cookies    if __name__ == '__main__':  unittest.main() 

以上這篇python:接口間數據傳遞與調用方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林站長站。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 嘉黎县| 上杭县| 黎川县| 育儿| 凤冈县| 沾益县| 辛集市| 来凤县| 桐城市| 二连浩特市| 基隆市| 会泽县| 城步| 益阳市| 楚雄市| 潞城市| 苍山县| 新乡市| 湖北省| 濮阳市| 崇阳县| 开化县| 安溪县| 清苑县| 攀枝花市| 宜城市| 兰西县| 庄浪县| 双牌县| 黄龙县| 枞阳县| 北流市| 甘肃省| 杭锦后旗| 陵水| 乌审旗| 西青区| 马公市| 盐源县| 锡林浩特市| 苏尼特右旗|