def test_baidu(self): longin = get_xls('xls_name.xlsx', 'Sheet1') list_num = len(longin) for i in range(list_num): url = longin[i][2] methon = longin[i][1] username = longin[i][3] passwd = longin[i][4] header = {'content-type': 'application/json'} long_params = ConfigHttp() long_params.set_url(url) long_params.set_headers(header) parms = {'user_id': username, 'email': username} data = {'email': username, 'password': passwd} long_params.set_params(parms) long_params.set_data(data) print(url, methon, username, passwd) if methon == 'post': long_params.post() print(long_params.post().status_code) elif methon == 'get': long_params.get() print(long_params.get().status_code) else: print("end")
def test_sendH5(self): path = "/wkStRoute/api/sms/sendH5" post_parm = {"phoneNo": "18610660297", "validate": "001897f346018a61da3a46034203f6e9"} response = ConfigHttp() response.set_url(self.url+path) response.set_headers(self.header) response.set_data(post_parm) print(self.url+path) results = ConfigHttp.post_origi(response)
def test_matchStation_error(self): request = ConfigHttp() data = self.data_list[1] if data[1].lower() == 'post': request.set_url(data[2]) request.set_headers({ "content-type": "application/x-www-form-urlencoded;charset=utf-8" }) request.set_data({"lng": data[3], "lat": data[4]}) response = request.post() response_json = response.json() code = response_json.get('code') message = response_json.get('message') print(code, message) self.assertEqual(code, int(data[5])) self.assertEqual(message, data[6])
# 返回集群的领导者 # curl -w '\n' http://10.11.3.105:7601/leader # cfh.url = "http://10.11.3.105:7601/leader" # print(cfh.get().json()) # 加车 # curl --header "Content-Type: application/json" --request POST --data '{"type":"carinfo","data":["LA81F1HT3FA000030,20111111111111111130,11111111,京P5QV20,402882e0607944c801607cd988725d6d,,4028819d5b18f617015b192e432b011d,,,402882d25ddea6c7015ddeacf8700087,402882d25c0eeeed015c101333940ef3,,,2018-01-16 16:57:11,2018-05-13 14:21:50,1","LA81F1HT3FA000021,21222222222222222222222222222,京P5QV20,402882e0607944c801607cd988725d6d,,4028819d5b18f617015b192e432b011d,,,402882d25ddea6c7015ddeacf8700087,402882d25c0eeeed015c101333940ef3,,,2018-01-16 16:57:11,2018-05-13 14:21:50,1"]}' http://10.11.3.104:7000/batch data = { "type": "carinfo", "data": [ "LLLLF1HT3FA000030,20111111111111111130,11111111,\ 京P5QV20,402882e0607944c801607cd988725d6d,,4028819d5b18f617015b192e432b011d,,,\ 402882d25ddea6c7015ddeacf8700087,402882d25c0eeeed015c101333940ef3,,,\ 2018-01-16 16:57:11,2018-05-13 14:21:50,1", "LLLLF1HT3FA000021,21222222222222222222222222222,\ 京P5QV20,402882e0607944c801607cd988725d6d,,4028819d5b18f617015b192e432b011d,,,\ 402882d25ddea6c7015ddeacf8700087,402882d25c0eeeed015c101333940ef3,,,\ 2018-01-16 16:57:11,2018-05-13 14:21:50,1" ] } cfh.url = "http://10.11.3.104:5000/batch" cfh.set_data(json.dumps(data)) cfh.set_headers(headers) jsondata = cfh.post().json() print(jsondata) # 获取车辆信息 # curl -w ‘\n’ http://10.11.3.104:7000/carinfo?vin=LA81F1HT3FA000030 # 删车 # curl -w '\n' http://10.11.3.106:7000/delete?type=carinfo\&field=LA81F1HT3FA000030