Commit 95ba9a05 authored by 张伟男's avatar 张伟男

1

parents da34ce1c cfca6890
...@@ -9,5 +9,6 @@ login_vfc: ...@@ -9,5 +9,6 @@ login_vfc:
vfc_type: ${vfc_type} vfc_type: ${vfc_type}
face_token: ${face_token} face_token: ${face_token}
json: {} json: {}
isLogin: 1 #需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
...@@ -13,5 +13,5 @@ class web2_request(BaseRequest): ...@@ -13,5 +13,5 @@ class web2_request(BaseRequest):
return self.api_send(self.data["service_list"]) return self.api_send(self.data["service_list"])
if __name__ == '__main__': if __name__ == '__main__':
print(web2_request().service_list("1", "10", "-1")) print(web2_request().service_list("1", "10", "-1"))
\ No newline at end of file \ No newline at end of file
...@@ -6,4 +6,5 @@ service_list: ...@@ -6,4 +6,5 @@ service_list:
pagesize: ${pagesize} pagesize: ${pagesize}
is_online: ${is_online} is_online: ${is_online}
data: {} data: {}
json: {} json: {}
\ No newline at end of file isLogin: 1
\ No newline at end of file
develop_host: develop_host:
backend: http://backend.paas-develop.env # backend: http://backend.paas-develop.env
# doctor: http://doctor.paas-develop.env/ doctor: http://doctor.paas-develop.env
...@@ -62,6 +62,13 @@ class BaseRequest: ...@@ -62,6 +62,13 @@ class BaseRequest:
def api_send(self, req: dict): def api_send(self, req: dict):
host = self.api_load(path_setting.HOSTYAML_CONFIG) host = self.api_load(path_setting.HOSTYAML_CONFIG)
url_host = ""
if host["develop_host"].get("doctor") == "http://doctor.paas-develop.env":
url_host = host['develop_host']['doctor']
elif host["develop_host"].get("backend") == "http://backend.paas-develop.env":
url_host = host['develop_host']['backend']
raw = yaml.dump(req) # 将一个python对象生成为yaml文档 raw = yaml.dump(req) # 将一个python对象生成为yaml文档
for key, value in self.params.items(): for key, value in self.params.items():
raw = raw.replace(f"${{{key}}}", repr(value)) raw = raw.replace(f"${{{key}}}", repr(value))
...@@ -75,7 +82,7 @@ class BaseRequest: ...@@ -75,7 +82,7 @@ class BaseRequest:
# 调用具体case的url # 调用具体case的url
r = s.request( r = s.request(
req['method'], req['method'],
url=host['develop_host']['backend'] + req['url'], url=url_host + req['url'],
params=req.get('params'), params=req.get('params'),
# headers=user_headers, # headers=user_headers,
data=req.get('data'), data=req.get('data'),
......
...@@ -36,7 +36,18 @@ class LoginFunction: ...@@ -36,7 +36,18 @@ class LoginFunction:
return s return s
def get_doctor_session(self): def get_doctor_session(self):
pass url = self.host["develop_host"]["doctor"] + self.params["doctor_login"]["url"]
s = requests.session()
r = s.request(
self.params["doctor_login"]["method"],
url=url,
params=self.params["doctor_login"]["params"],
data=self.params["doctor_login"]["data"],
headers={'Connection': 'close'}
)
return s
......
...@@ -9,11 +9,14 @@ backend_login: ...@@ -9,11 +9,14 @@ backend_login:
vfc_type: vfc_type:
face_token: face_token:
#doctor_login: doctor_login:
# method: post method: post
# url: /api url: /api/web/account/login
# params: params: {}
# a: "a" data:
# data: name: "12345654321"
# b: "b" password: 123456
method: password
csrfmiddlewaretoken: "PKHywf6cMBZUkc5WfklO71bQNoMztAfv"
...@@ -5,4 +5,4 @@ service_list: ...@@ -5,4 +5,4 @@ service_list:
page: "1" page: "1"
pagesize: "10" pagesize: "10"
is_online: "-1" is_online: "-1"
assert: "1" assert: 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment