Esempio n. 1
0
 def test_01(self):
     """业务鉴权接口-库配置表-查询store的静态库"""
     #1请求头参数
     geturl = eval(self.url) + "/senserealty/platform/v1.0/confextra"
     join_str_get, ak, sk, tm, nonce = sort()
     get_sign = sign(join_str_get, sk)
     print("请求url是:%s,生成的排序加密串:%s,請求參數是%s" %
           (geturl, join_str_get, (ak, sk, get_sign, nonce, tm)))
     headers = self.headers
     headers["ak"] = eval(ak)
     headers["sign"] = get_sign
     headers["nonce"] = nonce
     headers["ts"] = tm
     #2请求参数(待参数化)
     querystring = {
         "store_id": "07e0822ad3",
         "type_id": "-1",
         "company_id": "ID1150",
         "group_name": ""
     }
     getrequest = self.res.get(url=geturl,
                               headers=headers,
                               params=querystring)
     print(getrequest.text)
     print(getrequest.url)
     self.assertEqual(getrequest.status_code, 200, msg="请求返回状态码错误")
Esempio n. 2
0
 def test_02(self):
     """业务鉴权接口-库配置表-store创建库"""
     #1参数组织
     posturl = eval(self.url) + "/senserealty/platform/v1.0/confextra"
     join_str_get, ak, sk, tm, nonce = sort()
     post_sign = sign(join_str_get, sk)
     print("请求url是:%s,生成的排序加密串:%s,請求參數是%s" %
           (posturl, join_str_get, (ak, sk, post_sign, nonce, tm)))
     headers = self.headers
     headers["ak"] = eval(ak)
     headers["sign"] = post_sign
     headers["nonce"] = nonce
     headers["ts"] = tm
     #2请求参数待参数化
     postdata = {
         'company_id': "ID1150",
         "store_id": "07e0822ad3",
         "ak": "l1-3dd91537-h0eb6c347fb6",
         "group_name": "test12666666",
         "type_id": 1000,
         "opq_model": "3.0.0"
     }
     postrequest = self.res.post(url=posturl,
                                 headers=headers,
                                 data=json.dumps(postdata))
     print(postrequest.text)
     print(postrequest.url)
     self.assertEqual(postrequest.status_code, 200, msg="请求返回状态码错误")
Esempio n. 3
0
 def test_01(self):
     """业务鉴权接口-库配置表-camera_name和camera_id"""
     # 1请求头参数
     geturl = eval(
         self.url
     ) + "/senserealty/platform/v1.0/statistics/summary/camerainfo"
     join_str_get, ak, sk, tm, nonce = sort()
     get_sign = sign(join_str_get, sk)
     print("请求url是:%s,生成的排序加密串:%s,請求參數是%s" %
           (geturl, join_str_get, (ak, sk, get_sign, nonce, tm)))
     headers = self.headers
     headers["ak"] = eval(ak)
     headers["sign"] = get_sign
     headers["nonce"] = nonce
     headers["ts"] = tm
     # 2请求参数(待参数化)
     querystring = {
         "store_id": "07e0822ad3",
         "start_time": "2019-11-24",
         "end_time": "2019-12-24"
     }
     getrequest = self.res.get(url=geturl,
                               headers=headers,
                               params=querystring)
     print(getrequest.text)
     print(getrequest.url)
     self.assertEqual(getrequest.status_code, 200, msg="请求返回状态码错误")
Esempio n. 4
0
 def test_02(self):
     """业务鉴权接口-识别结果"""
     # 1请求头参数
     geturl = eval(self.url) + "/senserealty/platform/v1.0/trace"
     join_str_get, ak, sk, tm, nonce = sort()
     get_sign = sign(join_str_get, sk)
     print("请求url是:%s,生成的排序加密串:%s,請求參數是%s" %
           (geturl, join_str_get, (ak, sk, get_sign, nonce, tm)))
     headers = self.headers
     headers["ak"] = eval(ak)
     headers["sign"] = get_sign
     headers["nonce"] = nonce
     headers["ts"] = tm
     # 2请求参数(待参数化)
     start_time = "1577203200"
     end_time = "1577258779"
     group_id = "e8b8027ffc"
     device_id = "30:9c:23:a0:1c:75"
     limit = 10
     geturl = "http://172.30.1.176:11111/senserealty/platform/v1.0/trace?start_time=%s&end_time=%s&group_id=%s&device_id=%s&limit=%s" % (
         start_time, end_time, group_id, device_id, limit)
     print(geturl)
     self.Trick.setUrl(geturl)
     getrequest = self.Trick.get(url=geturl, headers=headers)
     print(getrequest.text)
     print(getrequest.url)
     self.assertTrue(getrequest.status_code == 200, msg="请求返回状态码错误")
     self.assertTrue(getrequest.json().get("error_code") == 0)
     self.assertTrue(getrequest.json().get("error_msg") == "ok")
Esempio n. 5
0
 def test_03(self):
     """统计功能对外接口-获取camera_name和camera_id"""
     # 1请求头参数
     geturl = eval(
         self.url
     ) + "/senserealty/platform/v1.0/statistics/summary/camerainfo"
     join_str_get, ak, sk, tm, nonce = sort()
     get_sign = sign(join_str_get, sk)
     headers = self.headers
     headers["ak"] = eval(ak)
     headers["sign"] = get_sign
     headers["nonce"] = nonce
     headers["ts"] = tm
     #2请求参数(待参数化)
     querysting = {
         "store_id": "de848b669b",
         "start_time": "2019-11-23",
         "end_time": "2019-12-23"
     }
     getrequest = self.res.get(url=geturl,
                               headers=headers,
                               params=querysting)
     print("统计功能对外接口-获取camera_name和camera_id", getrequest.text)
     print("统计功能对外接口-获取camera_name和camera_id", getrequest.url)
     self.assertTrue(getrequest.status_code == 200, msg="请求返回状态码错误")
     self.assertTrue(getrequest.json().get("error_code") == 0)
     self.assertTrue(getrequest.json().get("error_msg") == "ok")
Esempio n. 6
0
 def test_02(self):
     """统计功能对外接口-人数统计接口(按小时)"""
     # 1请求头参数
     posturl = eval(
         self.url) + "/senserealty/platform/v1.0/statistics/summary/hours"
     join_str_get, ak, sk, tm, nonce = sort()
     post_sign = sign(join_str_get, sk)
     #print("请求url是:%s,生成的排序加密串:%s,請求參數是%s" % (posturl, join_str_get, (ak, sk, post_sign, nonce, tm)))
     headers = self.headers
     headers["ak"] = eval(ak)
     headers["sign"] = post_sign
     headers["nonce"] = nonce
     headers["ts"] = tm
     # 2请求参数(待参数化)
     postdata = {
         "store_id": "de848b669b",
         "start_time": "2019-12-23",
         "end_time": "2019-12-23",
         "camera_id": ""
     }
     postrequest = self.res.post(url=posturl,
                                 headers=headers,
                                 data=json.dumps(postdata))
     print(postrequest.text)
     print(postrequest.url)
     self.assertTrue(postrequest.status_code == 200, msg="请求返回状态码错误")
     self.assertTrue(postrequest.json().get("error_code") == 0)
     self.assertTrue(postrequest.json().get("error_msg") == "ok")
     self.assertTrue(((
         postrequest.json().get("info")).get("total_lists")[0]).get("date"))
Esempio n. 7
0
 def test_06(self):
     """统计功能对外接口-以图搜图接口"""
     # 1请求头参数
     posturl = eval(self.url) + "/sensego/v2.0/realestate/realestate/trace"
     join_str_get, ak, sk, tm, nonce = sort()
     post_sign = sign(join_str_get, sk)
     #print("请求url是:%s,生成的排序加密串:%s,請求參數是%s" % (posturl, join_str_get, (ak, sk, post_sign, nonce, tm)))
     headers = self.headers
     headers["ak"] = eval(ak)
     headers["sign"] = post_sign
     headers["nonce"] = nonce
     headers["ts"] = tm
     headers["Content-Type"] = "multipart/form-data"
     # 2请求参数(待参数化)
     with open("20170508134213.png", "rb") as fp:
         # b64encode是编码,b64decode是解码
         base64_data = base64.b64encode(fp.read())
         #base64.b64decode(base64_data)
         print(base64_data)
     postdata = {
         "group_id": "de848b669b",
         "face_image": base64_data,
         "ak": ak,
         "sign": post_sign,
         "nonce": nonce,
         "ts": tm
     }
     postrequest = self.res.get(url=posturl,
                                headers=headers,
                                data=json.dumps(postdata))
     print(postrequest.text)
     print(postrequest.url)
     self.assertTrue(postrequest.status_code == 200, msg="请求返回状态码错误")
     self.assertTrue(postrequest.json().get("error_code") == 0)
     self.assertTrue(postrequest.json().get("error_msg") == "ok")
Esempio n. 8
0
 def test_05(self):
     """统计功能对外接口-频次统计"""
     # 1请求头参数
     posturl = eval(
         self.url) + "/senserealty/platform/v1.0/statistics/frequencycount"
     join_str_get, ak, sk, tm, nonce = sort()
     post_sign = sign(join_str_get, sk)
     #print("请求url是:%s,生成的排序加密串:%s,請求參數是%s" % (posturl, join_str_get, (ak, sk, post_sign, nonce, tm)))
     headers = self.headers
     headers["ak"] = eval(ak)
     headers["sign"] = post_sign
     headers["nonce"] = nonce
     headers["ts"] = tm
     # 2请求参数(待参数化)
     postdata = {"group_id": "de848b669b"}
     postrequest = self.res.post(url=posturl,
                                 headers=headers,
                                 data=json.dumps(postdata))
     print("员工考勤数据频次统计接口:", postrequest.text)
     print("员工考勤数据频次统计接口:", postrequest.url)
     self.assertTrue(postrequest.status_code == 200, msg="请求返回状态码错误")
     self.assertTrue(postrequest.json().get("error_code") == 0)
     self.assertTrue(postrequest.json().get("error_msg") == "ok")
     self.assertTrue(
         ((postrequest.json().get("frequency"))[0]).get("name") == "once")
Esempio n. 9
0
 def test_04(self):
     """统计功能对外接口-员工考勤数据统计"""
     # 1请求头参数
     posturl = eval(
         self.url
     ) + "/senserealty/platform/v1.0/statistics/summary/staff/attendance"
     join_str_get, ak, sk, tm, nonce = sort()
     post_sign = sign(join_str_get, sk)
     print("请求url是:%s,生成的排序加密串:%s,請求參數是%s" %
           (posturl, join_str_get, (ak, sk, post_sign, nonce, tm)))
     headers = self.headers
     headers["ak"] = eval(ak)
     headers["sign"] = post_sign
     headers["nonce"] = nonce
     headers["ts"] = tm
     # 2请求参数(待参数化)
     postdata = {
         "store_id": "de848b669b",
         "company_id": "ID1150",
         "start_date": "",
         "end_date": "2019-12-23"
     }
     postrequest = self.res.post(url=posturl,
                                 headers=headers,
                                 data=json.dumps(postdata))
     print("员工考勤数据统计接口:", postrequest.text)
     print(postrequest.url)
     self.assertTrue(postrequest.status_code == 200, msg="请求返回状态码错误")
     self.assertTrue(postrequest.json().get("error_code") == 0)
     self.assertTrue(postrequest.json().get("error_msg") == "ok")