Пример #1
0
 def setUp(self) -> None:
     self.login_api = login()
     self.tender_api = tenderAPI()
     self.session = requests.Session()
     #登录成功
     response = self.login_api.login(self.session)
     logging.info("login response={}".format(response.json()))
     assert_util(self, response, 200, 200, "登录成功")
Пример #2
0
def get_headers(host, phone, password):
    headers = rc.read_json()['headers']
    headers['Authorization'] = l.login(host, phone, password)
    headers['Host'] = "api-sandbox.hxgp.com"
    return headers


# print(get_headers('161','13511012200','123123123'))
Пример #3
0
 def setUp(self) -> None:
     self.trust_api = trustAPI()
     self.login_api = login()
     self.session = requests.session()
     #0、登录
     response = self.login_api.login(self.session)
     logging.info('login response = {}'.format(response.json()))
     assert_util(self, response, 200, 200, '登录成功')
Пример #4
0
def manager(host,phone,password,customer_code):
    path1 = '{}'.format(readConfig.read_json()['url'][str(host)])
    path2 = '/v1/staff/{}?nothing=' .format(customer_code)
    url1 = path1 + path2
    path3 = '{}'.format(readConfig.read_json()['path']['staff'])
    url2 = path1 + path3
    headers = readConfig.read_json()['headers']
    headers['Authorization'] = login.login(host,phone,password)
    res1 = requests.get(url=url1,headers=headers)
    data = {
        'staffNo':customer_code
    }
    res2 = requests.post(url=url2,data=data,headers=headers)
    mess = '{}\n{}'.format(res1.json(),res2.json())
    if 'hasStaffServer' in mess:
        print(mess)
Пример #5
0
def face_ocr(host,phone,password):
    url = "{}{}".format(readConfig.read_json()['url'][str(host)],readConfig.read_json()['path']['ocr'])
    headers = {"Connection": "keep-alive", "Host": "api-sandbox.hxgp.com"}
    headers['Authorization'] = login.login(host,phone,password)
    ocr_img_path = os.path.abspath(os.path.dirname(__file__))
    with open('{}\\1.jpg'.format(ocr_img_path),'rb') as frontImage:
        with open('{}\\2.jpg'.format(ocr_img_path),'rb') as backImage:
            files = {
                'frontImage':frontImage,
                'backImage':backImage
            }
            try:
                res = requests.post(url=url,headers=headers,files=files)
                result = json.loads(res.text)
                if 'idCardCode' and 'idCardName' in result:
                    print("OCR识别成功,识别结果为 :{}".format(res.text))
                else:
                    print("OCR识别成功,接口错误信息为:{}".format(res.text))
            except Exception as e:
                print("error_info:{}".format(str(e)))
 def setUpClass(cls) -> None:
     cls.login_api = login()
     cls.tender_api = tenderAPI()
     cls.trust_api = trustAPI()
     cls.session = requests.Session()
Пример #7
0
 def setUp(self) -> None:
     self.session = requests.Session()
     self.loginAPI = login()
Пример #8
0
def login_route():
    return login()
Пример #9
0
 def setUp(self) -> None:
     self.login_api = login()
     self.approve_api = approveAPI()
     self.session = requests.Session()