Commit 0f73d12f authored by 邓莹莹's avatar 邓莹莹

提交公共方法的修改,主要针对不同服务直接域名切换的

parent ecc83e8f
develop_host:
backend: http://backend.paas-develop.env
# om: http://om.paas-develop.env
# doctor: http://doctor.paas-develop.env
# backend: https://backend.igengmei.com
om: http://om.paas-develop.env
doctor: http://doctor.paas-develop.env
# backend_online: https://backend.igengmei.com
......@@ -59,7 +59,7 @@ class BaseRequest:
s = requests
if req.get('isLogin'):
s = LoginFunction().get_session()
s = LoginFunction().get_session(host_service)
# 调用具体case的url
r = s.request(
......
......@@ -15,56 +15,20 @@ class LoginFunction:
with open(path, encoding='utf-8') as f:
return yaml.safe_load(f)
def get_session(self):
hostList = self.host['develop_host']
for key in hostList:
if 'backend' == key:
return self.get_develop_session()
if 'doctor' == key:
return self.get_doctor_session()
elif 'om' == key:
return self.get_om_session()
def get_develop_session(self):
url = self.host["develop_host"]["backend"] + self.params["backend_login"]["url"]
def get_session(self, host_service):
project_login = host_service + "_login"
url = self.host["develop_host"][host_service] + self.params[project_login]["url"]
s = requests.session()
r = s.request(
self.params["backend_login"]["method"],
self.params[project_login]["method"],
url=url,
params=self.params["backend_login"]["params"],
data=self.params["backend_login"]["data"],
params=self.params[project_login]["params"],
data=self.params[project_login]["data"],
headers={'Connection': 'close'},
# verify=False
)
return s
def get_doctor_session(self):
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
def get_om_session(self):
url = self.host["develop_host"]["om"] + self.params["om_login"]["url"]
s = requests.session()
r = s.request(
self.params["om_login"]["method"],
url=url,
params=self.params["om_login"]["params"],
data=self.params["om_login"]["data"],
headers={'Connection': 'close'}
)
return s
if __name__ == '__main__':
LoginFunction().get_session()
\ No newline at end of file
......@@ -3,7 +3,7 @@ reply_create:
beuzhu: '# 备注: 这个文件有冲突的话,那个版本都行不会影响,回退/接受当前版本都行,因为每次运行content都会改变'
case: 日记贴一级评论创建--正常校验&创建二级评论--正常校验
channel: benzhan
content: ces测试+2021-06-23 11:41:50
content: ces测试+2021-06-28 16:25:25
message: 请勿回复重复内容
message1: 回复成功
message2: 你的回复有点频繁,稍后再来
......
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