Commit 4ee1023b authored by 林颖's avatar 林颖

Merge branch 'common_dev' of http://git.wanmeizhensuo.com/dengyingying/backend_auto into ly_dev

# Conflicts:
#	path_setting.py
parents 034b15a1 888722a0
......@@ -102,4 +102,4 @@ venv.bak/
/site
# mypy
.mypy_cache/
\ No newline at end of file
.mypy_cache/
......@@ -17,4 +17,5 @@ class account_request(BaseRequest):
if __name__ == '__main__':
print(account_request().login_vfc("beijing", "+8612345678912", 1234, "", ""))
\ No newline at end of file
# print(account_request().user_info())
print(account_request.loginvfc(""))
\ No newline at end of file
......@@ -9,3 +9,6 @@ login_vfc:
vfc_type: ${vfc_type}
face_token: ${face_token}
json: {}
isLogin: 1 #需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
password:
password:
method: post
url: /api/accounts/login/password
params:
......
import path_setting
from in_common.base_request import BaseRequest
class answer_request(BaseRequest):
def __init__(self):
self.abc = self.api_load(path_setting.DETAIL_CONFIG)
# print(self.abc)
# 回答详情页
def detail(self, current_city_id, answer_id=""):
self.params["current_city_id"] = current_city_id
self.params["answer_id"] = answer_id
return self.api_send(self.abc["detail"])
# 回答详情页点赞
def vote(self, answer_id=""):
self.params["answer_id"] = answer_id
return self.api_send(self.abc["vote"])
# 回答详情页取消点赞
def cancel_vote(self, answer_id=""):
self.params["answer_id"] = answer_id
return self.api_send(self.abc["cancel_vote"])
#回答详情页
detail:
method: get
url: /api/answer/detail
params:
current_city_id: ${current_city_id}
data:
answer_id: ${answer_id}
json: {}
# isLogin: 1 #需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
#回答详情页——点赞
vote:
method: post
url: /api/answer/vote
params:
current_city_id: ${current_city_id}
data:
answer_id: ${answer_id}
json: {}
isLogin: 1
#回答详情页——取消点赞
cancel_vote:
method: post
url: /api/answer/cancel_vote
params:
current_city_id: ${current_city_id}
data:
answer_id: ${answer_id}
json: {}
isLogin: 1
import path_setting
from in_common.base_request import BaseRequest
class conversation_request(BaseRequest):
def __init__(self):
self.messageread = self.api_load(path_setting.MESSAGE_READ_CONFIG)
def message_read(self,current_city_id,release,message_ids):
self.params["current_city_id"] = current_city_id
self.params["release"] = release
#self.params["uqid"] = uqid
self.params["message_ids"] = message_ids
return self.api_send(self.messageread["message_read"])
if __name__ == '__main__':
print(conversation_request().message_read("beijing", 1,'[10622,10626,10646,10651]'))
message_read:
method: post
url: /api/conversation/message/read
params:
current_city_id: ${current_city_id}
release: ${release}
#uqid: ${uqid}
data:
message_ids: ${message_ids}
json: {}
isLogin: 1 #需要登录的接口
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class doctor_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.DOCTOR_ARTICLE_CONFIG)
#医生/医院主页-医生说/医院说列表
def article(self, doctor_id):
self.params["doctor_id"] = doctor_id
return self.api_send(self.data["article"])
#医生主页详情
def detail(self):
return self.api_send(self.data["detail"])
#医生主页案例列表
def diary(self, doctor_id):
self.params["doctor_id"] = doctor_id
return self.api_send(self.data["diary"])
if __name__ == '__main__':
#打印医生/医院主页-医生说/医院说列表接口返回
print(doctor_request().article("9918ad7eb8f511e58f8200163e000a4a"))
#打印医生主页详情接口返回
print(doctor_request.detail())
#打印医生主页案例列表接口返回
print(doctor_request.diary("5bd9f05cad51403d853ba8c881989e23"))
\ No newline at end of file
#医生/医院主页——医生说/医院说
article:
method: get
url: /api/doctor/article
params:
doctor_id: ${doctor_id}
count: 10
page: 1
own_page: 0
doctor_type: 0
data: {}
json: {}
#医生主页详情
detail:
method: get
url: /api/doctor/5bd9f05cad51403d853ba8c881989e23/detail
params: {}
data: {}
json: {}
#医生主页案例列表
diary:
method: get
url: /api/doctor/diary
params:
doctor_id: ${doctor_id}
count: 4
page: 1
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class doctor_v2_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.DOCTOR_V2_CONFIG)
#医生主页商品列表
def services(self):
return self.api_send(self.data["services"])
if __name__ == '__main__':
#打印医生主页商品列表接口返回
print(doctor_v2_request().services())
\ No newline at end of file
#医生主页商品列表
services:
method: get
url: /api/doctor_v2/5bd9f05cad51403d853ba8c881989e23/services
params:
offset: 0
show_tag_distro: 1
tag_id: all
size: 10
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class eyelids_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.EYELIDS_DIARY_CARDS_CONFIG)
# 模拟整形,双眼皮,发型,美瞳,眉毛推荐日记
def diary_cards(self,current_city_id,page,page_size,tag_names):
self.params["current_city_id"] = current_city_id
self.params["page"] = page
self.params["page_size"] = page_size
self.params["tag_names"] = tag_names
return self.api_send(self.data["diary_cards"])
if __name__ == '__main__':
tag_names = '["埋线双眼皮","定点双眼皮","切开双眼皮"]'
print(eyelids_request().diary_cards("beijing","1","10",tag_names))
\ No newline at end of file
diary_cards:
method: get
url: /api/eyelids/diary_cards
params:
current_city_id: ${current_city_id}
page: ${page}
page_size: ${page_size}
tag_names: ${tag_names}
......@@ -5,6 +5,9 @@ from in_common.base_request import BaseRequest
class feed_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.FEED_INDEXV9_CONFIG)
self.data = self.api_load(path_setting.CONFIG_LIST_CONFIG)
self.data = self.api_load(path_setting.COMMUNITY_CONFIG)
def index_v9(self,tabtype,version,current_city_id):
self.params["tabtype"] = tabtype
......@@ -13,6 +16,27 @@ class feed_request(BaseRequest):
return self.api_send(self.data["index_v9"])
#社区tab页签到和招募活动列表
def config_list(self,version):
self.params["version"] = version
return self.api_send(self.data["config_list"])
# 社区tab页feed流
def community(self, version, tabtype, tags_id, tab_id):
self.params["version"] = version
self.params["tabtype"] = tabtype
self.params["tags_id"] = tags_id
self.params["tab_id"] = tab_id
return self.api_send(self.data["community"])
if __name__ == '__main__':
print(feed_request().index_v9("choice", "7.42.2", "beijing"))
\ No newline at end of file
print(feed_request().index_v9("choice", "7.42.2", "beijing"))
#社区tab页签到和招募活动列表
print(feed_request().config_list())
#社区tab页签到和招募活动列表
print(feed_request().community())
\ No newline at end of file
......@@ -7,3 +7,27 @@ index_v9:
current_city_id: ${current_city_id}
data:
json: {}
isLogin: 1
#社区tab签到和招募活动列表
config_list:
method: get
url: /api/feed/community_activity/config_list
params:
version: ${version}
data:
json: {}
isLogin: 1
#社区tab页feed流
community:
method: get
url: /api/feed/index/community
params:
version: ${version}
tabtype: choice
tags_id: []
tab_id: 0
data:
json: {}
isLogin: 1
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class gmai_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.GMAI_SKIN_NEWREPORT_CONFIG)
# 测颜值结果页
def skin_newReport(self,version,image_url):
self.params["version"] = version
self.params["image_url"] = image_url
return self.api_send(self.data["skin_newReport"])
# 模拟双眼皮
def eyelids_plastic(self,version,image_url,style_id):
self.params["version"] = version
self.params["image_url"] = image_url
self.params["style_id"] = style_id
return self.api_send(self.data["eyelids_plastic"])
# 模拟发型,眉毛,美瞳效果
def simulate_analyze(self,device_id,image_url,style_id,type_id):
self.params["device_id"] = device_id
self.params["image_url"] = image_url
self.params["style_id"] = style_id
self.params["type_id"] = type_id
return self.api_send(self.data["simulate_analyze"])
# AI测颜值及对应评价内容
def plastic_analysis_v3(self,device_id,image_url,landmark,cheek_style_classify_id):
self.params["device_id"] = device_id
self.params["image_url"] = image_url
self.params["landmark"] = landmark
self.params["cheek_style_classify_id"] = cheek_style_classify_id
return self.api_send(self.data["analysis_v3"])
# 获取模拟配置文件(发型,美瞳,眉毛,双眼皮)
def simulate_conf(self,type_id):
self.params["type_id"] = type_id
return self.api_send(self.data["simulate_conf"])
# 3D整形获取风格脸信息,并且对应的评价内容
def plastic_analystic_v2(self,device_id,image_url,landmark,cheek_style_classify_id):
self.params["device_id"] = device_id
self.params["image_url"] = image_url
self.params["landmark"] = landmark
self.params["cheek_style_classify_id"] = cheek_style_classify_id
return self.api_send(self.data["plastic_analystic_v2"])
if __name__ == '__main__':
# landmark = '[{"x":168.96603,"y":496.76886},{"x":168.35735,"y":527.7101},{"x":169.548,"y":558.3961},{"x":171.72018,"y":588.8369},{"x":174.93307,"y":619.26794},{"x":179.31195,"y":649.03467},{"x":184.17123,"y":678.6978},{"x":191.05627,"y":707.8003},{"x":200.86497,"y":735.76196},{"x":214.62796,"y":761.79736},{"x":231.40042,"y":785.7622},{"x":250.59685,"y":807.22406},{"x":272.07196,"y":826.8049},{"x":295.4251,"y":843.86194},{"x":321.47278,"y":856.83124},{"x":349.9967,"y":864.5885},{"x":379.85767,"y":866.998},{"x":409.25287,"y":865.863},{"x":437.7829,"y":859.18054},{"x":463.35132,"y":846.88574},{"x":486.354,"y":830.38916},{"x":507.7304,"y":811.95135},{"x":527.778,"y":791.59247},{"x":545.7143,"y":769.32104},{"x":561.4353,"y":745.4949},{"x":573.70917,"y":719.9794},{"x":583.3716,"y":690.47156},{"x":591.3898,"y":660.6565},{"x":598.52515,"y":631.38513},{"x":604.5137,"y":601.75684},{"x":609.14844,"y":572.0621},{"x":612.0713,"y":541.85956},{"x":613.5779,"y":511.5329},{"x":203.42625,"y":444.83066},{"x":229.21182,"y":410.30188},{"x":270.9198,"y":399.64984},{"x":313.56497,"y":407.32513},{"x":354.0185,"y":422.54175},{"x":441.31384,"y":427.71216},{"x":482.0569,"y":416.21152},{"x":524.1508,"y":412.38593},{"x":563.6658,"y":426.22824},{"x":585.87964,"y":462.41913},{"x":394.46844,"y":504.41254},{"x":393.96762,"y":546.5007},{"x":393.30322,"y":588.8532},{"x":392.592,"y":631.0979},{"x":342.77267,"y":664.1739},{"x":364.95947,"y":668.7595},{"x":390.1893,"y":673.2006},{"x":415.25336,"y":670.5106},{"x":436.7552,"y":666.998},{"x":242.81853,"y":506.60803},{"x":262.98138,"y":497.55713},{"x":305.08954,"y":499.77777},{"x":321.22906,"y":513.3391},{"x":301.56146,"y":521.4862},{"x":260.00668,"y":519.3686},{"x":462.97388,"y":517.84485},{"x":480.18396,"y":505.8437},{"x":522.09973,"y":506.45386},{"x":540.26013,"y":517.4052},{"x":523.0011,"y":528.3126},{"x":482.06146,"y":527.1489},{"x":239.75659,"y":436.6534},{"x":277.67075,"y":433.85788},{"x":315.04602,"y":438.8376},{"x":351.56638,"y":447.66888},{"x":441.58453,"y":452.58017},{"x":477.96664,"y":447.28973},{"x":515.05225,"y":445.83618},{"x":551.5746,"y":451.62656},{"x":284.38373,"y":496.0074},{"x":280.49805,"y":523.8891},{"x":284.44955,"y":508.43988},{"x":501.19617,"y":503.6411},{"x":502.51047,"y":530.9885},{"x":501.47836,"y":515.5879},{"x":357.51913,"y":508.84628},{"x":428.91504,"y":511.1767},{"x":341.02893,"y":607.7458},{"x":442.021,"y":610.8187},{"x":324.796,"y":641.13324},{"x":456.35925,"y":645.5844},{"x":304.6747,"y":728.90186},{"x":334.5838,"y":715.599},{"x":369.0162,"y":710.4512},{"x":390.31683,"y":714.9321},{"x":411.64032,"y":711.3696},{"x":445.83594,"y":718.7887},{"x":474.80075,"y":735.1745},{"x":451.05292,"y":753.0734},{"x":421.3767,"y":761.7219},{"x":390.41638,"y":763.2075},{"x":358.4326,"y":759.44385},{"x":328.53287,"y":748.5295},{"x":311.38818,"y":729.83777},{"x":350.23193,"y":734.1919},{"x":390.38123,"y":737.72284},{"x":429.7071,"y":736.18054},{"x":468.49692,"y":735.4535},{"x":430.71494,"y":739.61053},{"x":391.11005,"y":741.01697},{"x":349.98578,"y":737.08875},{"x":284.5382,"y":508.54742},{"x":501.50644,"y":515.53107}]'
# print(gmai_request().plastic_analystic_v2("869412032478155", "2021/06/01/1524/8a28dd0a3b8e",landmark,1))
# print(gmai_request().simulate_conf("-1"))
print(gmai_request().simulate_analyze("869412032478155","2021/06/02/1456/68c702f50309","3","7"))
# landmark = '[{"x":248.60858,"y":454.0434},{"x":247.92863,"y":476.7021},{"x":248.8779,"y":499.36874},{"x":251.12755,"y":521.8638},{"x":254.58401,"y":544.24164},{"x":259.10333,"y":566.1669},{"x":264.02515,"y":588.0588},{"x":270.59506,"y":609.44214},{"x":279.6361,"y":629.6998},{"x":291.60773,"y":648.29407},{"x":305.6806,"y":665.26465},{"x":321.33615,"y":680.4736},{"x":338.2943,"y":694.64526},{"x":356.13144,"y":707.5386},{"x":375.71283,"y":717.8617},{"x":397.27545,"y":724.19965},{"x":419.9613,"y":726.1914},{"x":441.62817,"y":725.2733},{"x":462.6242,"y":719.917},{"x":481.41635,"y":710.3818},{"x":498.45187,"y":697.98035},{"x":514.59436,"y":684.40234},{"x":529.7782,"y":669.4685},{"x":543.08704,"y":653.1195},{"x":554.60706,"y":635.73456},{"x":563.3266,"y":617.3142},{"x":570.0075,"y":596.0911},{"x":575.7123,"y":574.78046},{"x":581.05774,"y":554.0385},{"x":585.48157,"y":533.1105},{"x":588.66907,"y":512.06683},{"x":590.4706,"y":490.68823},{"x":591.2653,"y":469.50403},{"x":279.37485,"y":410.2143},{"x":299.98352,"y":383.6742},{"x":331.64465,"y":375.0197},{"x":364.35858,"y":381.4741},{"x":395.4406,"y":394.20447},{"x":466.45248,"y":397.95},{"x":496.4015,"y":389.2094},{"x":527.33295,"y":386.7473},{"x":555.7313,"y":398.20285},{"x":571.48254,"y":425.62354},{"x":427.4568,"y":456.95285},{"x":426.77496,"y":483.84033},{"x":426.04883,"y":510.83325},{"x":425.32236,"y":537.75256},{"x":385.83856,"y":572.9858},{"x":403.71045,"y":573.0551},{"x":423.23145,"y":574.53534},{"x":442.28857,"y":574.4508},{"x":459.13876,"y":574.9396},{"x":307.80756,"y":458.6329},{"x":323.8154,"y":450.41855},{"x":359.07312,"y":453.8022},{"x":371.75238,"y":466.2728},{"x":355.36838,"y":470.9956},{"x":321.71375,"y":468.2021},{"x":479.14362,"y":470.68353},{"x":492.57837,"y":459.77023},{"x":526.78955,"y":459.34094},{"x":540.76917,"y":469.22626},{"x":526.91675,"y":477.2774},{"x":494.3828,"y":476.6469},{"x":307.39963,"y":402.42038},{"x":336.54358,"y":400.2494},{"x":365.31128,"y":405.05597},{"x":393.4093,"y":412.95276},{"x":466.55408,"y":416.23398},{"x":493.2259,"y":412.04782},{"x":520.28235,"y":410.81372},{"x":546.7446,"y":415.7663},{"x":341.78073,"y":449.21838},{"x":338.20166,"y":471.98853},{"x":342.39044,"y":460.15692},{"x":509.66327,"y":456.7909},{"x":510.57373,"y":479.22314},{"x":508.77704,"y":467.26038},{"x":399.44565,"y":461.61548},{"x":453.4572,"y":463.86423},{"x":384.4139,"y":527.5456},{"x":463.68613,"y":530.3157},{"x":369.6485,"y":554.5674},{"x":475.98178,"y":558.04224},{"x":358.72372,"y":632.25916},{"x":379.92645,"y":612.99927},{"x":406.5278,"y":600.8932},{"x":422.78525,"y":604.4064},{"x":439.0467,"y":601.5054},{"x":463.0918,"y":613.59924},{"x":480.34888,"y":633.28406},{"x":463.28207,"y":645.23676},{"x":442.62195,"y":651.3627},{"x":420.9704,"y":652.71295},{"x":398.036,"y":651.2082},{"x":376.4565,"y":644.82745},{"x":363.59555,"y":631.5963},{"x":392.39032,"y":626.09314},{"x":422.20786,"y":626.16754},{"x":449.31833,"y":626.3133},{"x":475.72333,"y":632.3503},{"x":448.87988,"y":625.9888},{"x":421.7511,"y":626.1827},{"x":392.28534,"y":625.9193},{"x":342.4176,"y":460.03064},{"x":508.8405,"y":467.07236}]'
# 测颜值和 上次结果
# print(gmai_request().plastic_analysis_v3("869412032478155", "2021/06/01/1524/8a28dd0a3b8e",landmark,1))
# print(gmai_request().plastic_analysis_v3("869412032478155", "", "", 1))
# print(gmai_request().skin_newReport("7.43.0","https://pic.igengmei.com/2021/05/11/1440/25e4bf45673f-s"))
# print(gmai_request().eyelids_plastic("7.43.0", "2021/05/12/1457/cdbe8652117d","3"))
skin_newReport:
method: post
url: /gm_ai/skin/new_report
params:
version: ${version}
data:
image_url: ${image_url}
eyelids_plastic:
method: post
url: /gm_ai/eyelids/plastic
params:
version: ${version}
data:
image_url: ${image_url}
style_id: ${style_id}
analysis_v3:
method: post
url: /gm_ai/plastic/analysis_v3
params:
device_id: ${device_id}
data:
image_url: ${image_url}
landmark: ${landmark}
cheek_style_classify_id: ${cheek_style_classify_id}
simulate_analyze:
method: post
url: /gm_ai/simulate/analyze
params:
device_id: ${device_id}
data:
image_url: ${image_url}
style_id: ${style_id}
type_id: ${type_id}
simulate_conf:
method: get
url: /gm_ai/simulate/conf
params:
type_id: ${type_id}
plastic_analystic_v2:
method: post
url: /gm_ai/plastic/analysis_v2
params:
device_id: ${device_id}
data:
image_url: ${image_url}
landmark: ${landmark}
cheek_style_classify_id: ${cheek_style_classify_id}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class hospital_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.HOSPITAL_DIARY_CONFIG)
#医院主页日记列表
def diary(self, hospital):
self.params["hospital"] = hospital
return self.api_send(self.data["diary"])
if __name__ == '__main__':
#打印医院主页日记列表接口返回
print(hospital_request().diary("bjxyjcpfbyy"))
\ No newline at end of file
#医院主页日记列表
diary:
method: get
url: /api/hospital/diary
params:
hospital: ${hospital}
count: 4
page: 1
own_page: 0
tag_id:
data: {}
json: {}
\ No newline at end of file
......@@ -7,9 +7,18 @@ class hospitals_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.HDYAML_CONFIG)
#医院主页详情
def detail(self):
return self.api_send(self.data["detail"])
#医院主页医生列表
def doctor(self):
return self.api_send(self.data["doctor"])
if __name__ == '__main__':
print(hospitals_request().detail())
\ No newline at end of file
#打印医院主页详情接口返回
print(hospitals_request().detail())
#打印医院主页医生列表接口返回
print(hospitals_request().doctor())
\ No newline at end of file
#医院主页详情
detail:
method: get
url: /api/hospitals/bjxyjcpfbyy/detail
params: {}
data: {}
json: {}
#医院主页医生列表
doctor:
method: get
url: /api/hospitals/bjxyjcpfbyy/doctors
params:
related: 0
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class hospitals_v2_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.HOSPITAL_SERVICE_CONFIG)
#医院主页商品列表
def services(self):
return self.api_send(self.data["services"])
if __name__ == '__main__':
#打印医院主页商品列表接口返回
print(hospitals_v2_request().services())
\ No newline at end of file
#医院主页商品列表
services:
method: get
url: /api/hospitals_v2/bjxyjcpfbyy/services
params:
offset: 0
show_tag_distro: 1
tag_id: "all"
size: 10
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class hybrid_gift_list_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.HYBRID_GIFT_LIST_CONFIG)
#商祥页-美券列表
def gift_list_data(self, service_id, gift_type, page):
self.params["service_id"] = service_id
self.params["gift_type"] = gift_type
self.params["page"] = page
return self.api_send(self.data["gift_list_data"])
if __name__ == '__main__':
#打印商祥页-美券列表接口返回
print(hybrid_gift_list_request().gift_list_data("5857263", 1, 1))
\ No newline at end of file
#商祥页-美券列表
gift_list_data:
method: get
url: /hybrid/gift_list/_data
params:
service_id: ${service_id}
gift_type: ${gift_type}
page: ${page}
data: {}
json: {}
isLogin: 1
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class im_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.CONVERSATION_DETAIL_CONFIG)
def conversation_detail(self, current_city_id, begin_msg_id, conversation_type, end_msg_id,referrer):
self.params["current_city_id"] = current_city_id
self.params["begin_msg_id"] = begin_msg_id
self.params["conversation_type"] = conversation_type
self.params["end_msg_id"] = end_msg_id
self.params["referrer"] = referrer
return self.api_send(self.data["conversation_detail"])
def auto_msg(self, trace_id, conversation_id):
self.params["trace_id"] = trace_id
self.params["conversation_id"] = conversation_id
return self.api_send(self.data["auto_msg"])
def send_msg(self, conversation_id, is_system, referrer, referrer_id, msg_type, content, extra):
self.params["conversation_id"] = conversation_id
self.params["is_system"] = is_system
self.params["referrer"] = referrer
self.params["referrer_id"] = referrer_id
self.params["msg_type"] = msg_type
self.params["content"] = content
self.params["extra"] = extra
return self.api_send(self.data["send_msg"])
if __name__ == '__main__':
print(im_request().conversation_detail("beijing", 0, 4, 0, "message_home"))
print("第二个接口")
print(im_request().auto_msg("2021/04/22/1722/70a1791606d5",368))
print("send_msg")
print(im_request().send_msg("368", 0, "message_home", "", 0, "您好,我想咨询一下", {}))
conversation_detail:
method: get
url: /api/im/conversation/detail
params:
current_city_id: ${current_city_id}
begin_msg_id: ${begin_msg_id}
conversation_type: ${conversation_type}
end_msg_id: ${begin_msg_id}
referrer: ${referrer}
data: {}
json: {}
isLogin: 1 #需要登录的接口
auto_msg:
method: post
url: /api/im/auto_msg
params:
trace_id: ${trace_id}
data:
conversation_id: ${conversation_id}
json: {}
isLogin: 1 #需要登录的接口
send_msg:
method: post
url: /api/im/send_msg
params: {}
data:
conversation_id: ${conversation_id}
is_system: ${is_system}
referrer: ${referrer}
referrer_id: ${referrer_id}
msg_type: ${msg_type}
content: ${content}
extra: ${extra}
json: {}
isLogin: 1 #需要登录的接口
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class janus_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.CONTENTV7_CONFIG)
self.data = self.api_load(path_setting.HOSPITALSEARCH_CONFIG)
#品类聚合页面商品列表
self.data = self.api_load(path_setting.TAG_SERVICE_CONFIG)
#品类聚合页面标签和专场
self.data = self.api_load(path_setting.POLYMER_CONFIG)
#搜索结果页-综合/百科tab
def content_v7(self, query, device_id, current_city_id, version, is_first, tab_type, offset):
#搜索词
self.params['query'] = query
#设备号
self.params['device_id'] = device_id
#当前城市
self.params['current_city_id'] = current_city_id
#APP版本
self.params['version'] = version
#是否为第一次请求
self.params['is_first'] = is_first
#类型
self.params['tab_type'] = tab_type
#请求的页数 0,10,20
self.params['offset'] = offset
return self.api_send(self.data['content_v7'])
#医院主页搜索
def hospital_search(self, query, device_id, hospital_id, current_city_id, version, offset, size):
#搜索词
self.params['query'] = query
#设备号
self.params['device_id'] = device_id
#医院id
self.params['hospital_id'] = hospital_id
#当前城市
self.params['current_city_id'] = current_city_id
#APP版本
self.params['version'] = version
#请求的页数 0,10,20
self.params['offset'] = offset
# 单页请求数量
self.params['size'] = size
return self.api_send(self.data['hospital_search'])
#购物车-猜你喜欢列表
def mine_guess_you_like(self):
return self.api_send(self.data["mine_guess_you_like"])
#商祥页-详情
def product_detail(self, service_id, service_item_id, version):
self.params["service_id"] = service_id
self.params["service_item_id"] = service_item_id
self.params["version"] = version
return self.api_send(self.data["product_detail"])
#商祥页-sku信息
def sku_info(self, service_id, service_item_id):
self.params["service_id"] = service_id
self.params["service_item_id"] = service_item_id
return self.api_send(self.data["sku_info"])
# 品类聚合页面商品列表
def tag_service(self, size, tag_ids, offset, tag_id, version, device_id):
print("fgx")
self.params['size'] = size
self.params['tag_ids'] = tag_ids
self.params['offset'] = offset
self.params['tag_id'] = tag_id
self.params['version'] = version
self.params['device_id'] = device_id
return self.api_send(self.data["tag_service"])
# 品类聚合页面标签和专场
def polymer(self, version, category_polymer_id, device_id):
print("fgx")
self.params['version'] = version
self.params['category_polymer_id'] = category_polymer_id
self.params['device_id'] = device_id
return self.api_send(self.data["polymer"])
if __name__ == '__main__':
#打印购物车-猜你喜欢列表接口返回
print(janus_request().mine_guess_you_like())
#打印商祥页-详情接口返回
print(janus_request().product_detail("5857263", "618788", "7.43.0"))
#打印商祥页-sku信息接口返回
print(janus_request().sku_info("5857263", "618788"))
#品类聚合页面商品列表接口返回
print(janus_request().tag_service())
print("fgx")
#品类聚合页面标签和专场
print(janus_request().polymer())
print("fgx")
content_v7:
method : get
url : /api/janus/search/v7/content
params :
query: ${query}
device_id: ${device_id}
current_city_id: ${current_city_id}
version: ${version}
is_first: ${is_first}
tab_type: ${tab_type}
offset: ${offset}
data: {}
json: {}
hospital_search:
method: get
url: /api/janus/search/hospital_search
params:
query: ${query}
device_id: ${device_id}
hospital_id: ${hospital_id}
current_city_id: ${current_city_id}
version: ${version}
offset: ${offset}
size : ${size}
data: { }
json: { }
#购物车-猜你喜欢
mine_guess_you_like:
method: get
url: /api/janus/product/mine_guess_you_like
params: {}
data: {}
json: {}
isLogin: 1
#商祥页-详情
product_detail:
method: get
url: /api/janus/product/detail
params:
service_id: ${service_id}
service_item_id: ${service_item_id}
version: ${version}
data: {}
json: {}
#商祥页-sku信息
sku_info:
method: get
url: /api/janus/product/detail/sku_info
params:
service_id: ${service_id}
service_item_id: ${service_item_id}
data: {}
json: {}
#品类聚合页面商品列表的
tag_service:
method: GET
url: /api/janus/product/tag_service
params:
size: ${size}
tag_ids: ${tag_ids}
offset: ${offset}
tag_id: ${tag_id}
version: ${version}
device_id: ${device_id}
data: { }
json: { }
#品类聚合页标签和专场
polymer:
method: GET
url: /api/janus/product/polymer
params:
version: ${version}
category_polymer_id: ${category_polymer_id}
device_id: ${device_id}
data: { }
json: { }
import path_setting
from in_common.base_request import BaseRequest
class living_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.LIVEYAML_CONFIG)
#获取弹幕
def danmu_v2(self,channel_id,msg_id,user_id=""):
self.params["channel_id"] = channel_id
self.params["msg_id"] = msg_id
self.params["user_id"] = user_id
return self.api_send(self.data["danmu_v2"])
#主播开播
def pushlive_info(self,title,cover_url,notice,tag_id,clarity,device_type):
self.params["title"] = title
self.params["cover_url"] = cover_url
self.params["notice"] = notice
self.params["tag_id"] = tag_id
self.params["clarity"] = clarity
self.params["device_type"] = device_type
return self.api_send(self.data["pushlive_info"])
if __name__ == '__main__':
(living_request().danmu_v2("739", "1"))
(living_request().pushlive_info("小冤家", "2021/04/22/1003/cef471cff5e6", "", "1", "1", "1"))
\ No newline at end of file
#获取弹幕
danmu_v2:
method: get
url: /api/live/danmu_v2
params:
channel_id: ${channel_id}
msg_id: ${msg_id}
user_id: ${user_id}
data: {}
json: {}
#主播开播
pushlive_info:
method: get
url: /api/live/push_live_info
params:
title: ${title}
cover_url: ${cover_url}
notice: ${notice}
tag_id: ${tag_id}
clarity: ${clarity}
device_type: ${device_type}
data: {}
json: {}
isLogin: 1
import path_setting
from in_common.base_request import BaseRequest
class my_conversation_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.MY_CONVERSATION_CONFIG)
def my_conversation(self,current_city_id,start_num,count,):
self.params["current_city_id"] = current_city_id
self.params["start_num"] = start_num
self.params["count"] = count
return self.api_send(self.data["my_conversation"])
if __name__ == '__main__':
print(my_conversation_request().my_conversation("beijing", "0", 10))
\ No newline at end of file
my_conversation:
method: get
url: /api/my_conversation/
params:
current_city_id: ${current_city_id}
start_num: ${start_num}
count: 10
data: {}
json: {}
isLogin: 1 #需要登录的接口
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class notification_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.UNREAD_CONFIG)
def unread(self,uqid,trace_id,):
self.params["uqid"] = uqid
self.params["trace_id"] = trace_id
return self.api_send(self.data["unread"])
def readall(self,uqid,trace_id,ua):
self.params["uqid"] = uqid
self.params["trace_id"] = trace_id
self.params["ua"] = ua
return self.api_send(self.data["readall"])
if __name__ == '__main__':
#print(notification_request().unread("1B519701-A4F5-453E-9D99-140B5AF697A0", "2021/04/22/1722/46cf97b999b0"))
print(notification_request().readall("1B519701-A4F5-453E-9D99-140B5AF697A0", "2021/05/19/1526/19fcd4c4be47","Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"))
#未读消息数
unread:
method: get
url: /api/notification/unread
params:
uqid: ${uqid}
trace_id: ${trace_id}
data: {}
json: {}
isLogin: 1 #需要登录的接口
#标记为已读
readall:
method: post
url: /api/notification/readall
params:
uqid: ${uqid}
trace_id: ${trace_id}
ua: ${ua}
data: {}
json: {}
isLogin: 1 #需要登录的接口
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class oneimage_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.ONEIMAGE_SHARE_V4_CONFIG)
# 测颜值结果页
def share_v4(self,version,face_id):
self.params["version"] = version
self.params["face_id"] = face_id
return self.api_send(self.data["share_v4"])
# 测颜值结果页,根据五官推荐美购接口
def recomend_services(self,version,business_tags_names):
self.params["version"] = version
self.params["business_tags_names"] = business_tags_names
return self.api_send(self.data["recomend_services"])
if __name__ == '__main__':
print(oneimage_request().share_v4("7.42.2", "27320150"))
business_tags_names = '[[],[],["玻尿酸垫下巴","自体脂肪垫下巴","硅胶垫下巴","膨体垫下巴"],["半永久纹眉","植眉"],["玻尿酸丰唇","胶原蛋白填充丰唇","自体脂肪丰唇"],[],["开内眼角"],["射频提升","热拉提","热拉提plus","热玛吉","超声提升"],["热玛吉"],[],["注射瘦脸","激光溶脂瘦脸","取颊脂垫瘦脸","光纤溶脂瘦脸","下颌角整形"]]'
print(oneimage_request().recomend_services("7.42.2", business_tags_names))
\ No newline at end of file
#测肤结果页
share_v4:
method: post
url: /api/one_image/share/v4
params:
version: ${version}
data:
face_id: ${face_id}
json: {}
#测肤结果根据五官推荐美购
recomend_services:
method: get
url: /api/one_image/recomend/services
params:
version: ${version}
business_tags_names: ${business_tags_names}
json: {}
import path_setting
from in_common.base_request import BaseRequest
class private_conversation_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.PRIVATE_CONVERSATION_CONFIG)
def private_conversation(self, content, target_uid, referrer,referrer_id, is_system, quick_consultation_id, diary_id, from_live):
self.params["content"] = content
self.params["target_uid"] = target_uid
self.params["referrer"] = referrer
self.params["referrer_id"] = referrer_id
self.params["is_system"] = is_system
self.params["quick_consultation_id"] = quick_consultation_id
self.params["diary_id"] = diary_id
self.params["from_live"] = from_live
return self.api_send(self.data["private_conversation"])
if __name__ == '__main__':
print(private_conversation_request().private_conversation("你好", "35874935", "message_home", "", 0, "", "", ""))
\ No newline at end of file
private_conversation:
method: post
url: /api/private_conversation/
params: {}
data:
content: ${content}
target_uid: ${target_uid}
referrer: ${referrer}
referrer_id: ${referrer_id}
is_system: ${is_system}
quick_consultation_id: ${quick_consultation_id}
diary_id: ${diary_id}
from_live: ${from_live}
json: {}
isLogin: 1 #需要登录的接口
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class question_request(BaseRequest):
def __init__(self):
self.replyanswer = self.api_load(path_setting.QUESTION_CONFIG)
# print(self.replyanswer)
# 回答详情页- 一/二级评论
def reply_answer(self, current_city_id, answer_id, content, user_id=""):
self.params["current_city_id"] = current_city_id
self.params["answer_id"] = answer_id
self.params["content"] = content
self.params["user_id"] = user_id
return self.api_send(self.replyanswer["reply_answer"])
#回答详情页- 一/二级评论
reply_answer:
method: post
url: /api/question/reply_answer
params:
current_city_id: ${current_city_id}
data:
answer_id: ${answer_id}
content: ${content}
user_id: ${user_id}
json: {}
isLogin: 1
\ No newline at end of file
......@@ -4,10 +4,31 @@ from in_common.base_request import BaseRequest
class search_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.KEYWORDS_CONFIG)
self.data = self.api_load(path_setting.KEYWORDS_CONFIG) #keywords路径
self.data = self.api_load(path_setting.CONTENTV6_CONFIG) #content_v6路径
#搜索首页-热门搜索模块(点击搜索框即调接口)
def keywords(self,current_city_id,search_tab):
self.params["current_city_id"] = current_city_id
self.params["search_tab"] = search_tab
return self.api_send(self.data["keywords"])
\ No newline at end of file
return self.api_send(self.data["keywords"])
#搜索结果页-医生/医院tab
def content_v6(self, query, device_id, current_city_id, version, is_first, tab_type, offset, size):
#搜索词
self.params['query'] = query
#设备号
self.params['device_id'] = device_id
#当前城市
self.params['current_city_id'] = current_city_id
#APP版本
self.params['version'] = version
#是否为第一次请求
self.params['is_first'] = is_first
#类型
self.params['tab_type'] = tab_type
#请求的页数 0,10,20
self.params['offset'] = offset
# 请求的size
self.params['size'] = size
return self.api_send(self.data["content_v6"])
\ No newline at end of file
......@@ -7,4 +7,21 @@ keywords:
current_city_id: ${current_city_id}
search_tab: ${search_tab}
data: {}
json: {}
content_v6:
method: get
#接口地址
url: /api/search/v6/content
#列出所有定义函数时的参数
params:
query: ${query}
device_id: ${device_id}
current_city_id: ${current_city_id}
version: ${version}
is_first: ${is_first}
tab_type: ${tab_type}
offset: ${offset}
size: ${size}
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class service_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.HOME_V5_CONFIG) #/all_backend_api/service_request.yaml
def home_v5(self):
return self.api_send(self.data["home_v5"])
#商祥页-收藏
def service_favor(self):
return self.api_send(self.data["service_favor"])
if __name__ == '__main__':
print(service_request().home_v5())
#打印商祥页-收藏接口返回
print(service_request().service_favor())
\ No newline at end of file
home_v5:
method: get
url: /api/service/home/v5
params: {}
data: {}
json: {}
#商祥页-收藏
service_favor:
method: post
url: /api/service/favor/5857263/
params: {}
data: {}
json: {}
isLogin: 1
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class services_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.SERVICES_CONFIG)
#商祥页-分享
def share_data(self, p_id, u_id):
self.params["p_id"] = p_id
self.params["u_id"] = u_id
return self.api_send(self.data["share_data"])
if __name__ == '__main__':
#打印商祥页-分享接口返回
print(services_request().share_data("5857263", "618788"))
\ No newline at end of file
#商祥页-分享
share_data:
method: get
url: /api/services/share_data
params:
p_id: ${p_id}
u_id: ${u_id}
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class shopcart_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.SHOPCART_CONFIG)
#购物车列表
def list(self):
return self.api_send(self.data["list"])
#商祥页-加入购物车
def add(self, from_live, number, service_item_id):
self.params["from_live"] = from_live
self.params["number"] = number
self.params["service_item_id"] = service_item_id
return self.api_send(self.data["add"])
if __name__ == '__main__':
#打印购物车列表接口返回
print(shopcart_request().list())
#打印商祥页-加入购物车接口返回
print(shopcart_request().add("", 1, "618788"))
\ No newline at end of file
#购物车列表
list:
method: get
url: /api/shopcart/list/v2
params: {}
data: {}
json: {}
isLogin: 1
#商祥页-加入购物车
add:
method: post
url: /api/shopcart/add/v1
params: {}
data:
from_live: ${from_live}
number: ${number}
service_item_id: ${service_item_id}
json: {}
isLogin: 1
\ No newline at end of file
login_thirdphone:
method: post
url: /api/account/login/third_phone_login
params:
version: ${version}
data:
phone_data: ${phone_data}
phone_from_type: ${phone_from_type}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class thirdphonelogin_request(BaseRequest):
def __init__(self):
self.thirdphonelogin = self.api_load(path_setting.THIRD_PHONE_LOGIN_CONFIG)
def thirdphone_login(self,version,phone_data,phone_from_type):
self.params["version"] = version
self.params["phone_data"] = phone_data
self.params["phone_from_type"] = phone_from_type
return self.api_send(self.thirdphonelogin["login_thirdphone"])
import path_setting
from in_common.base_request import BaseRequest
class user_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.PERSONAL_CENTER_CONFIG)
def personal_center(self):
print("fgx")
return self.api_send(self.data["personal_center"])
def __init__(self):
self.data = self.api_load(path_setting.USER_ANSWER_CONFIG)
#医院主页问答列表
def answer(self, user):
self.params["user"] = user
return self.api_send(self.data["answer"])
if __name__ == '__main__':
#个人中心
print(user_request().personal_center())
print("fgx")
#打印医生/医院主页问答列表接口返回
print(user_request().answer("21476198"))
personal_center:
method: GET
url: /api/user/personal_center
params:
choose_id: 0
community_id: 0
version: 7.42.0
data: {}
json: {}
isLogin: 1
#医院主页-问答接口
answer:
method: get
url: /api/user/answer
params:
user: ${user}
count: 10
page: 1
data: {}
json: {}
import path_setting
from in_common.base_request import BaseRequest
class xcx_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.XCX_GENGMEI_GET_WXACODE_UNLIMITED_CONFIG)
# 测颜值结果页获取小程序分享二维码
def gengmei_get_wxacode_unlimited(self,page,scene):
self.params["page"] = page
self.params["scene"] = scene
return self.api_send(self.data["get_wxacode_unlimited"])
if __name__ == '__main__':
print(xcx_request().gengmei_get_wxacode_unlimited("pages/scanFace/report/main","scan_code=gm_code&fid=27923989"))
get_wxacode_unlimited:
# 获取
method: get
url: /xcx/gengmei/get_wxacode_unlimited
params:
page: ${page}
scene: ${scene}
......@@ -4,14 +4,36 @@ from in_common.base_request import BaseRequest
class web2_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.SERVICE_URL)
self.SERVICE_URL = self.api_load(path_setting.SERVICE_URL)
# self.SERVICE_REVIEW_URL = self.api_load(path_setting.SERVICE_REVIEW_URL)
def service_list(self, page,pagesize,is_online):
def service_list(self, page,pagesize,is_online,extra_filter_choice):
self.params["page"] = page
self.params["pagesize"] = pagesize
self.params["is_online"] = is_online
self.params["extra_filter_choice"] = extra_filter_choice
return self.api_send(self.SERVICE_URL["service_list"])
return self.api_send(self.data["service_list"])
def service_review_list(self,page,pagesize,type):
self.params["page"] = page
self.params["pagesize"] = pagesize
self.params["type"] = type
return self.api_send(self.SERVICE_URL["service_review_list"])
def servicereview_option(self,id, type,csrfmiddlewaretoken):
self.params["id"] = id
self.params["type"] = type
self.params["csrfmiddlewaretoken"] = csrfmiddlewaretoken
return self.api_send(self.SERVICE_URL["servicereview_option"])
def tag_all(self) :
return self.api_send(self.SERVICE_URL["tag_all"])
if __name__ == '__main__':
print(web2_request().service_list("1", "10", "-1", "-1"))
print(web2_request().service_review_list("1", "10", "0"))
print(web2_request().servicereview_option("209989", "1", "PC8uTySuxipukIMuqNV1OPB376C2ZZ3g"))
if __name__ == '__main__':
print(web2_request().service_list("1", "10", "-1"))
\ No newline at end of file
print(web2_request().tag_all())
\ No newline at end of file
......@@ -5,5 +5,49 @@ service_list:
page: ${page}
pagesize: ${pagesize}
is_online: ${is_online}
extra_filter_choice: ${extra_filter_choice}
data:
phone_num: ${phone_num}
vfc_code: ${vfc_code}
face_token: ${face_token}
json: {}
isLogin: 1
service_review_list:
method: get
url: /api/web2/service/review/list
params:
page: ${page}
pagesize: ${pagesize}
type: ${type}
data:
phone_num: ${phone_num}
vfc_code: ${vfc_code}
face_token: ${face_token}
json: {}
isLogin: 1
servicereview_option:
method: POST
url: /api/web2/servicereview/option
params: {}
data:
id: ${id}
type: ${type}
csrfmiddlewaretoken: ${csrfmiddlewaretoken}
phone_num: ${phone_num}
vfc_code: ${vfc_code}
face_token: ${face_token}
json: {}
isLogin: 1
tag_all:
method: get
url: /api/web2/tag/all
param: {}
data: {}
json: {}
\ No newline at end of file
json: {}
isLogin: 1
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class web_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.ACCOUNT_URL)
def account_unreadbadgecount(self) :
return self.api_send(self.data["account_unreadbadgecount"])
def article_videotoken(self) :
return self.api_send(self.data["article_videotoken"])
def doctor_submechanisms(self) :
return self.api_send(self.data["doctor_submechanisms"])
if __name__ == '__main__':
print(web_request().account_unreadbadgecount())
print(web_request().article_videotoken())
print(web_request().doctor_submechanisms())
account_unreadbadgecount:
method: get
url: /api/web/account/unread_badge_count
param: {}
data: {}
json: {}
isLogin: 1
article_videotoken:
method: get
url: /api/web/article/video_token
param: {}
data: {}
json: {}
isLogin: 1
doctor_submechanisms:
method: get
url: /api/web/doctor/submechanisms
param: {}
data: {}
json: {}
isLogin: 1
develop_host:
url: http://backend.paas-develop.env
# url: http://doctor.paas-develop.env/
backend: http://backend.paas-develop.env
# doctor: http://doctor.paas-develop.env
# backend: https://backend.igengmei.com
......@@ -2,7 +2,11 @@
此文件是用来将case转换成list
'''
def get_ids(data, path):
def get_ids(data: object, path: object) -> object:
"""
@rtype:
"""
params = data[path]
case = []
for ids in params:
......
......@@ -4,15 +4,14 @@ import string
import requests
import yaml
from jsonpath import jsonpath
from login_session_function import LoginFunction
# from pymysql import OperationalError
import path_setting
class BaseRequest:
params = {}
data = {}
@classmethod
def format(cls, r):
......@@ -26,7 +25,7 @@ class BaseRequest:
return yaml.safe_load(f)
# 调用yaml加载文件API加载
def api_load(self, path):
def api_load(self, path: object) -> object:
return self.yaml_load(path)
def jsonpath(self, path, r=None, **kwargs):
......@@ -34,63 +33,44 @@ class BaseRequest:
r = self.r.json()
return jsonpath(r, path)
def get_cookie(self, req: dict):
host = self.api_load(path_setting.HOSTYAML_CONFIG)
print(host)
r = requests.request(
req['method'],
url=host['develop_host']['url'] + req['url'],
params=req['params'],
headers=req['headers'],
data=req['data'],
json=req['json']
)
dict = {}
for i in r.cookies:
dict[i.name] = i.value
headers = '_gtid={};sessionid={}'.format(dict["_gtid"], dict["sessionid"])
# item = r.cookies.values()
# print("ppppppp",item)
# if len(item) == 1:
# headers = '_gtid={}'.format(item[0])
# print("cookie异常")
#
# else:
# headers = '_gtid={};sessionid={}'.format(item[0], item[1])
#
return headers
def read_header(self):
with open("../in_common/get_cookie.txt", 'r', encoding='utf-8') as f:
cookies = f.read()
headers = {"cookie": cookies}
return headers
# 接口请求的封装
def api_send(self, req: dict):
def api_send(self, req: object) -> object:
host = self.api_load(path_setting.HOSTYAML_CONFIG)
# 获取调用该方法的路径
import inspect
ins_file = inspect.stack()[1].filename
ins_dir = ins_file.split('/')[-2]
host_service = ins_dir.split('_')[1]
# default: backend
if host_service not in host['develop_host']:
host_service = 'backend'
url_host = host['develop_host'][host_service]
# if host["develop_host"].get("doctor") is not None:
# url_host = host['develop_host']['doctor']
# elif host["develop_host"].get("backend") is not None:
# url_host = host['develop_host']['backend']
raw = yaml.dump(req) # 将一个python对象生成为yaml文档
for key, value in self.params.items():
raw = raw.replace(f"${{{key}}}", repr(value))
req = yaml.safe_load(raw)
print('req:',req)
# print('------', req.get('headers'))
# hd = req.get('headers')
# if hd == None:
# user_headers = self.read_header()
# elif hd["Cookie"]:
# user_headers = req.get('headers')
# else:
# user_headers = self.read_header()
r = requests.request(
print('req:', req)
s = requests
if req.get('isLogin'):
s = LoginFunction().get_session()
# 调用具体case的url
r = s.request(
req['method'],
url=host['develop_host']['url'] + req['url'],
url=url_host + req['url'],
params=req.get('params'),
# headers=user_headers,
data=req.get('data'),
json=req.get('json')
json=req.get('json'),
# proxies={"http":"172.30.9.226:8888"}
)
return r.json()
......@@ -98,8 +78,33 @@ class BaseRequest:
def trace_id(self):
return ''.join(random.sample(string.ascii_lowercase + string.digits, 32))
'''
def get_cookie(self, req: dict):
host = self.api_load(path_setting.HOSTYAML_CONFIG)
print(host)
r = requests.request(
req['method'],
url=host['develop_host']['url'] + req['url'],
params=req['params'],
headers=req['headers'],
data=req['data'],
json=req['json']
)
dict = {}
for i in r.cookies:
dict[i.name] = i.value
headers = '_gtid={};sessionid={}'.format(dict["_gtid"], dict["sessionid"])
return headers
def read_header(self):
with open("../in_common/get_cookie.txt", 'r', encoding='utf-8') as f:
cookies = f.read()
headers = {"cookie": cookies}
return headers
'''
if __name__ == '__main__':
BaseRequest().api_load("../api/api.yaml")
# print(BaseApi().trace_id())
BaseRequest().read_header()
# BaseRequest().api_load("../api/api.yaml")
print(BaseRequest().trace_id())
import path_setting
import requests
import yaml
"""
此文件是封装session的
"""
class LoginFunction:
def __init__(self):
self.host = self.login_yaml_load(path_setting.HOSTYAML_CONFIG)
self.params = self.login_yaml_load(path_setting.LOGIN_FUNCTION_DATA)
def login_yaml_load(self, path) -> list:
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()
elif 'doctor' == key:
return self.get_doctor_session()
def get_develop_session(self):
url = self.host["develop_host"]["backend"] + self.params["backend_login"]["url"]
s = requests.session()
r = s.request(
self.params["backend_login"]["method"],
url=url,
params=self.params["backend_login"]["params"],
data=self.params["backend_login"]["data"],
headers={'Connection': 'close'}
)
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
if __name__ == '__main__':
LoginFunction().get_session()
\ No newline at end of file
backend_login:
method: POST
url: /api/account/login/login_vfc
params:
current_city_id: "beijing"
data:
phone_num: "+8612345678912"
vfc_code: 1234
vfc_type:
face_token:
doctor_login:
method: post
url: /api/web/account/login
params: {}
data:
name: "12345654321"
password: 123456
method: password
csrfmiddlewaretoken: "PKHywf6cMBZUkc5WfklO71bQNoMztAfv"
This diff is collapsed.
......@@ -32,8 +32,14 @@
- test_backend_data 文件主要放测试用例的case
- host.yaml 维护测试环境的配置文件
- path_setting.py 文件主要是配置yaml文件的读取路径
- login_session_function.py 文件主要提供获取session的功能,方便需登录的接口获取session 2021-4-19新增
- login_session_function.yaml login_session_function.py文件需要登录的数据 2021-4-19新增
- run.py 统一执行入口
### 关于yaml文明书写的注意事项 2021-4-19新增
- yaml文件对空格换行要求非常严格,所以书写时要特别注意
![](.readme_images/yaml文件错误示范.png)
### 如何写一个用例
- 先在all_backend_api下找到对应的模块,比如我写节点account下面的接口,那就找到account_request.py这个文件,写接口请求
......
from in_common.base_request import BaseRequest
import path_setting
from ids_list import get_ids
import pytest
from all_backend_api.thirdphonelogin_request import *
class TestThirdPhoneLogin:
data = BaseRequest().api_load(path_setting.THIRD_PHONE_LOGIN)
thirdphonelogin_case,thirdphonelogin_data = get_ids(data,"login_thirdphone")
@pytest.mark.parametrize("param",thirdphonelogin_data,ids = thirdphonelogin_case)
def test_thirdphone_login(self,param):
r = thirdphonelogin_request().thirdphone_login(param["version"],param["phone_data"],param["phone_from_type"])
if r["error"] == 1:
assert r['message'] == param["assert"]
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.answer_request import answer_request
class TestCancelVote:
data = BaseRequest().api_load(path_setting.CANCEL_VOTE)
cancelvote_case, cancelvote_data = get_ids(data, "cancel_vote")
@pytest.mark.parametrize("param", cancelvote_data, ids=cancelvote_case)
def test_cancel_vote(self, param):
r = answer_request().cancel_vote(param["answer_id"])
if r["error"] == 1:
assert r["message"] == param["assert"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.account_request import account_request
class TestLoginVfc:
data = BaseRequest().api_load(path_setting.LOGIN_VFC)
loginvfc_case, loginvfc_data = get_ids(data, "login_vfc")
@pytest.mark.parametrize("param",loginvfc_data,ids=loginvfc_case)
def test_login_vfc(self,param):
print(param["vfc_code"])
r = account_request().login_vfc(param["current_city_id"], param["phone_num"], param["vfc_code"])
if r["error"] == 0:
assert r["data"]["account_phone"] == param["assert"]
if r["error"] == 1:
assert r["message"] == param["assert"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.answer_request import answer_request
class TestVote:
data = BaseRequest().api_load(path_setting.VOTE)
vote_case, vote_data = get_ids(data, "vote")
@pytest.mark.parametrize("param", vote_data, ids=vote_case)
def test_vote(self, param):
r = answer_request().vote(param["answer_id"])
if r["error"] == 1:
assert r["message"] == param["assert"]
import pytest
import path_setting
@pytest.fixture()
def login():
self.data = self.api_load(path_setting.APYAML_CONFIG)
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.conversation_request import conversation_request
class TestMessageRead:
data = BaseRequest().api_load(path_setting.MESSAGE_READ)
#conversation_case, conversation_data = get_ids(data, "message_read")
messageread_case, messageread_data = get_ids(data, "message_read")
@pytest.mark.parametrize("param",messageread_data,ids=messageread_case)
def test_message_read(self,param):
r = conversation_request().message_read(param["current_city_id"], param["release"], param["message_ids"])
if r["error"] == 0:
assert r["data"]["success"] == param["assert"]
#if r["error"] == 0:
# success = r.get("data").get("success", "")
import pytest
from all_backend_api.doctor_request import doctor_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestArticle:
data = BaseRequest().api_load(path_setting.DOCTOR_ARTICLE)
article_case, article_data = get_ids(data, "article")
@pytest.mark.parametrize("param", article_data, ids=article_case)
def test_article(self, param):
r = doctor_request().article(param["doctor_id"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.doctor_request import doctor_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestDetail:
data = BaseRequest().api_load(path_setting.DOCTOR_DETAIL)
detail_case, detail_data = get_ids(data, "detail")
@pytest.mark.parametrize("param", detail_data, ids=detail_case)
def test_detail(self, param):
r = doctor_request().detail()
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.doctor_request import doctor_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestDiary:
data = BaseRequest().api_load(path_setting.DOCTOR_DIARY)
diary_case, diary_data = get_ids(data, "diary")
@pytest.mark.parametrize("param", diary_data, ids=diary_case)
def test_diary(self, param):
r = doctor_request().diary(param["doctor_id"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.doctor_v2_request import doctor_v2_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestServices:
data = BaseRequest().api_load(path_setting.DOCTOR_V2_SERVICE)
services_case, services_data = get_ids(data, "services")
@pytest.mark.parametrize("param", services_data, ids=services_case)
def test_services(self, param):
r = doctor_v2_request().services()
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.eyelids_request import eyelids_request
class TestDiaryCards:
data = BaseRequest().api_load(path_setting.EYELIDS_DIARY_CARDS_DATA)
eyelidsDiaryCards_case, eyelidsDiaryCards_data = get_ids(data, "diary_cards")
@pytest.mark.skip("跳过目前测试环境没有数据-------------------")
@pytest.mark.parametrize("param",eyelidsDiaryCards_data,ids=eyelidsDiaryCards_case)
def test_diary_cards(self,param):
r = eyelids_request().diary_cards(param["current_city_id"], param["page"], param["page_size"],param["tag_names"])
assert r["error"] == 0
assert len(r["data"]) == 10
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.feed_request import feed_request
class TestCommunity:
data = BaseRequest().api_load(path_setting.COMMUNITY)
community_case, community_data = get_ids(data, "community")
@pytest.mark.parametrize("param", community_data, ids=community_case)
def test_community(self, param):
r = feed_request().community(param["version"], param["tabtype"], param["tags_id"], param["tab_id"])
if r["error"] == 0:
assert r["data"]["features"][0] != param["assert"]
# else:
# assert r["data"]["config_list"][0]["type"] == param["assert1"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.feed_request import feed_request
class TestConfigList:
data = BaseRequest().api_load(path_setting.CONFIG_LIST)
configlist_case, configlist_data = get_ids(data, "config_list")
@pytest.mark.parametrize("param",configlist_data,ids=configlist_case)
def test_config_list(self,param):
r = feed_request().config_list(param["version"])
if r["error"] == 0:
assert r["data"]["config_list"][0]["type"] != param["assert"]
# else:
# assert r["data"]["config_list"][0]["type"] == param["assert1"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# 模拟双眼皮效果
class TestEyelidsPlastic:
data = BaseRequest().api_load(path_setting.GMAI_EYELIDS_PLASTIC_DATA)
eyelidsplastic_case, eyelidsplastic_data = get_ids(data, "eyelids_plastic")
@pytest.mark.parametrize("param",eyelidsplastic_data,ids=eyelidsplastic_case)
def test_skinnewReport(self,param):
r = gmai_request().eyelids_plastic(param["version"], param["image_url"],param["style_id"])
assert r["error"] == 0
print("模拟双眼皮效果图片: ",r["data"]["plastic_image_url"])
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# 3D变脸
class TestPlasticnAnalysisV2:
data = BaseRequest().api_load(path_setting.GMAI_PLASTIC_ANALYSIS_V2_DATA)
plasticanalysisv2_case, plasticanalysisv2_data = get_ids(data, "analysis_v2")
@pytest.mark.parametrize("param",plasticanalysisv2_data,ids=plasticanalysisv2_case)
def test_plastic_analysis_v3(self,param):
r = gmai_request().plastic_analystic_v2(param["device_id"], param["image_url"], param["landmark"],param["cheek_style_classify_id"])
if r["error"] == 0:
faces = r["data"]["faces"]
assert len(faces) > 0, f'3D变脸没有返回风格脸,请查看 {len(faces)}'
# 分析信息,取默认第一条
card_info = faces[0]["card_info"]
analyze = card_info.get("analyze")
level = card_info.get("level")
# content = card_info.get("content")
print(analyze,level)
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# AI测颜值,目前测试环境没有召回日记,先保证请求成功
class TestPlasticnAnalysisV3:
data = BaseRequest().api_load(path_setting.GMAI_PLASTIC_ANALYSIS_V3_DATA)
plasticanalysisv3_case, plasticanalysisv3_data = get_ids(data, "analysis_v3")
@pytest.mark.parametrize("param",plasticanalysisv3_data,ids=plasticanalysisv3_case)
def test_plastic_analysis_v3(self,param):
r = gmai_request().plastic_analysis_v3(param["device_id"], param["image_url"], param["landmark"] ,param["cheek_style_classify_id"])
assert r["error"] == 0
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# 模拟发型,眉毛,美瞳
class TestSimulateAnalyze:
data = BaseRequest().api_load(path_setting.GMAI_SIMULATE_ANALYZE_DATA)
simulateanalyze_case, simulateanalyze_data = get_ids(data, "simulate_analyze")
@pytest.mark.parametrize("param",simulateanalyze_data,ids=simulateanalyze_case)
def test_plastic_analysis_v3(self,param):
r = gmai_request().simulate_analyze(param["device_id"], param["image_url"], param["style_id"] ,param["type_id"])
assert r["error"] == 0
print("效果图: ", r["data"]["plastic_image_url"])
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# 获取模拟整形相关配置数据,双眼皮,美瞳,眉毛和发型
class TestSimulateConf:
data = BaseRequest().api_load(path_setting.GMAI_SIMULATE_CONF_DATA)
simulateconf_case, simulateconf_data = get_ids(data, "simulate_conf")
@pytest.mark.parametrize("param",simulateconf_data,ids=simulateconf_case)
def test_plastic_conf(self,param):
r = gmai_request().simulate_conf(param["type_id"])
assert r["error"] == 0
# 模拟发型数据,发型类型
hairdos = r["data"]["hairdo_configs"]["hairdos"]
assert len(hairdos) > 0
# 美瞳
colorcon = r["data"]["colorcon_configs"]["colorcon"]
# 眉毛
eyebrow = r["data"]["eyebrow_configs"]["eyebrow"]
# 双眼皮
eyelids = r["data"]["eyelid_configs"]["eyelids"]
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# 测肤结果页
class TestSkinNewReport:
data = BaseRequest().api_load(path_setting.GMAI_SKIN_NEWREPORT_DATA)
skinnewReport_case, skinnewReport_data = get_ids(data, "skin_newReport")
@pytest.mark.parametrize("param",skinnewReport_data,ids=skinnewReport_case)
def test_skinnewReport(self,param):
r = gmai_request().skin_newReport(param["version"], param["image_url"])
if r["error"] == 0:
data = r.get("data")
# 大家都在买
packages = data.get("packages")
assert len(packages) == 6
# 皮肤检测结果
disadvantage_tabs = data.get("disadvantage_tabs")
result_word = disadvantage_tabs[0].get("result_word")
assert result_word == "色素型黑眼圈"
import pytest
from all_backend_api.hospital_request import hospital_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestDiary:
data = BaseRequest().api_load(path_setting.HOSPITAL_DIARY)
diary_case, diary_data = get_ids(data, "diary")
@pytest.mark.parametrize("param", diary_data, ids=diary_case)
def test_diary(self, param):
r = hospital_request().diary(param["hospital"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.hospitals_request import hospitals_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestDoctor:
data = BaseRequest().api_load(path_setting.HOSPITAL_DOCTOR)
doctor_case, doctor_data = get_ids(data, "doctor")
@pytest.mark.parametrize("param", doctor_data, ids=doctor_case)
def test_doctor(self, param):
r = hospitals_request().doctor()
assert r["error"] == param["assert_error"]
assert r["data"][0]["id"] == param["assert_id"]
assert r["data"][0]["doctor_name"] == param["assert_name"]
assert r["data"][0]["good_at"][0] == param["assert_good_at"]
assert r["data"][0]["cases"][0]["name"] == param["assert_cases"]
assert r["data"][0]["title"] == param["assert_title"]
import pytest
from all_backend_api.hospitals_v2_request import hospitals_v2_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestServices:
data = BaseRequest().api_load(path_setting.HOSPITAL_SERVICE)
services_case, services_data = get_ids(data, "services")
@pytest.mark.parametrize("param", services_data, ids=services_case)
def test_detail(self, param):
r = hospitals_v2_request().services()
if r["error"] == 0:
assert r["error"] == param["assert_error"]
# assert r["data"]["services"][0]["service_item_id"] == param["assert_sku"]
# assert r["data"]["services"][0]["service_id"] == param["assert_spu"]
# assert r["data"]["services"][0]["price_info"]["has_discount"] == param["assert_discount"]
# assert r["data"]["services"][0]["sales_info"][0]["type"] == param["assert_sales"]
# assert r["data"]["services"][0]["exposure"]["card_type"] == param["assert_card_type"]
# assert r["data"]["services"][0]["title"] == param["assert_title"]
# assert r["data"]["tag_distribution"][0]["selected"] == param["assert_tagselected"]
import pytest
from all_backend_api.hybrid_gift_list_request import hybrid_gift_list_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestGiftListData:
data = BaseRequest().api_load(path_setting.GIFT_LIST_DATA)
gift_list_data_case, gift_list_data_data = get_ids(data, "gift_list_data")
@pytest.mark.parametrize("param", gift_list_data_data, ids=gift_list_data_case)
def test_gift_list_data(self, param):
r = hybrid_gift_list_request().gift_list_data(param["service_id"], param["gift_type"], param["page"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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