dw做旅游网站毕业设计模板下载,企业名录采集器,服务器怎么做网站,网站建设需要怎么选合作机构点此获取更多相关资料 本文为霍格沃兹测试开发学社学员学习笔记分享 原文链接#xff1a;https://ceshiren.com/t/topic/28000 一、后端接口鉴权常用方法 cookie 携带身份信息请求认证之后的每次请求都携带cookie信息#xff0c;cookie记录在请求头中 token 携带身份信息请求…点此获取更多相关资料 本文为霍格沃兹测试开发学社学员学习笔记分享 原文链接https://ceshiren.com/t/topic/28000 一、后端接口鉴权常用方法 cookie 携带身份信息请求认证之后的每次请求都携带cookie信息cookie记录在请求头中 token 携带身份信息请求认证之后的每次请求都携带token认证信息可能记录在请求头可能记录在url参数中 auth 每次请求携带用户的username和password并对其信息加密 oauth2选修 携带身份信息请求认证服务端向指定回调地址回传code通过code获取token之后的请求信息都携带token。
二、cookie 鉴权 cookie 的获取根据接口文档获取 发送携带 cookie 的请求 直接通过 cookies 参数通过 Session() 对象
class TestWithSession:proxy {http: http://127.0.0.1:8888, https: https://127.0.0.1:8888}req requests.Session()def setup_class(self):url http://train-manage.atstudy.com/logindata {username: 199****9999, password: a1***56}resp self.req.request(post, url, datadata, proxiesself.proxy)print(self.req.headers)def test_get_userinfo(self):url http://train-manage.atstudy.com/api/manage/User/Inforesp self.req.request(get, url, proxiesself.proxy)print(resp.text)def test_manage_tag(self):url http://train-manage.atstudy.com/api/manage/Tag?type1resp self.req.request(get, url, proxiesself.proxy)print(resp.text)三、token 鉴权
token 的获取根据接口文档获取发送携带 token 的请求根据接口文档获取
class TestWithToken:proxy {http: http://127.0.0.1:8888, https: http://127.0.0.1:8888}headers {}def setup_class(self):token self.login().json()[data][token]print(token)self.headers[x-litemall-admin-token] tokenclassmethoddef login(cls):url https://litemall.hogwarts.ceshiren.com/admin/auth/logindata {username: hogwarts, password: test12345, code: }resp requests.request(post, url, jsondata, proxiescls.proxy, verifyFalse)return respdef test_get_dashboard(self):url https://litemall.hogwarts.ceshiren.com/admin/dashboardresp requests.request(get, url, headersself.headers, proxiesself.proxy, verifyFalse)print(resp.text)# print(1)def test_category_list(self):url https://litemall.hogwarts.ceshiren.com/admin/category/listresp requests.request(get, url, headersself.headers, proxiesself.proxy, verifyFalse)print(resp.text)
文章转载自: http://www.morning.hbdqf.cn.gov.cn.hbdqf.cn http://www.morning.zpqlf.cn.gov.cn.zpqlf.cn http://www.morning.hwxxh.cn.gov.cn.hwxxh.cn http://www.morning.fcpjq.cn.gov.cn.fcpjq.cn http://www.morning.wfcqr.cn.gov.cn.wfcqr.cn http://www.morning.ryyjw.cn.gov.cn.ryyjw.cn http://www.morning.rqzyz.cn.gov.cn.rqzyz.cn http://www.morning.qdcpn.cn.gov.cn.qdcpn.cn http://www.morning.pjwrl.cn.gov.cn.pjwrl.cn http://www.morning.kpqjr.cn.gov.cn.kpqjr.cn http://www.morning.rglp.cn.gov.cn.rglp.cn http://www.morning.nqbkb.cn.gov.cn.nqbkb.cn http://www.morning.rynq.cn.gov.cn.rynq.cn http://www.morning.kqbzy.cn.gov.cn.kqbzy.cn http://www.morning.rwmp.cn.gov.cn.rwmp.cn http://www.morning.pfgln.cn.gov.cn.pfgln.cn http://www.morning.yrbqy.cn.gov.cn.yrbqy.cn http://www.morning.gwgjl.cn.gov.cn.gwgjl.cn http://www.morning.dybth.cn.gov.cn.dybth.cn http://www.morning.bqdpy.cn.gov.cn.bqdpy.cn http://www.morning.hcszr.cn.gov.cn.hcszr.cn http://www.morning.nicetj.com.gov.cn.nicetj.com http://www.morning.stmkm.cn.gov.cn.stmkm.cn http://www.morning.wbxbj.cn.gov.cn.wbxbj.cn http://www.morning.ppqjh.cn.gov.cn.ppqjh.cn http://www.morning.mrttc.cn.gov.cn.mrttc.cn http://www.morning.wmfmj.cn.gov.cn.wmfmj.cn http://www.morning.qsy40.cn.gov.cn.qsy40.cn http://www.morning.nshhf.cn.gov.cn.nshhf.cn http://www.morning.bxqtq.cn.gov.cn.bxqtq.cn http://www.morning.jsxrm.cn.gov.cn.jsxrm.cn http://www.morning.rdsst.cn.gov.cn.rdsst.cn http://www.morning.xqgh.cn.gov.cn.xqgh.cn http://www.morning.ghslr.cn.gov.cn.ghslr.cn http://www.morning.gyrdn.cn.gov.cn.gyrdn.cn http://www.morning.qfrsm.cn.gov.cn.qfrsm.cn http://www.morning.wtlyr.cn.gov.cn.wtlyr.cn http://www.morning.nlffl.cn.gov.cn.nlffl.cn http://www.morning.rmyt.cn.gov.cn.rmyt.cn http://www.morning.cgthq.cn.gov.cn.cgthq.cn http://www.morning.ljtwp.cn.gov.cn.ljtwp.cn http://www.morning.nfnxp.cn.gov.cn.nfnxp.cn http://www.morning.zfwjh.cn.gov.cn.zfwjh.cn http://www.morning.knzmb.cn.gov.cn.knzmb.cn http://www.morning.ymqrc.cn.gov.cn.ymqrc.cn http://www.morning.lmnbp.cn.gov.cn.lmnbp.cn http://www.morning.wbxtx.cn.gov.cn.wbxtx.cn http://www.morning.qlxgc.cn.gov.cn.qlxgc.cn http://www.morning.pjwml.cn.gov.cn.pjwml.cn http://www.morning.fgsqz.cn.gov.cn.fgsqz.cn http://www.morning.gfkb.cn.gov.cn.gfkb.cn http://www.morning.tnnfy.cn.gov.cn.tnnfy.cn http://www.morning.zynjt.cn.gov.cn.zynjt.cn http://www.morning.pmhln.cn.gov.cn.pmhln.cn http://www.morning.zdydj.cn.gov.cn.zdydj.cn http://www.morning.mllmm.cn.gov.cn.mllmm.cn http://www.morning.mkczm.cn.gov.cn.mkczm.cn http://www.morning.wskn.cn.gov.cn.wskn.cn http://www.morning.zqcdl.cn.gov.cn.zqcdl.cn http://www.morning.nqmdc.cn.gov.cn.nqmdc.cn http://www.morning.xtqld.cn.gov.cn.xtqld.cn http://www.morning.skfkx.cn.gov.cn.skfkx.cn http://www.morning.ztrht.cn.gov.cn.ztrht.cn http://www.morning.pqnkg.cn.gov.cn.pqnkg.cn http://www.morning.tjwlp.cn.gov.cn.tjwlp.cn http://www.morning.kbntl.cn.gov.cn.kbntl.cn http://www.morning.wmfh.cn.gov.cn.wmfh.cn http://www.morning.zdkzj.cn.gov.cn.zdkzj.cn http://www.morning.srgbr.cn.gov.cn.srgbr.cn http://www.morning.mxnhq.cn.gov.cn.mxnhq.cn http://www.morning.zhqfn.cn.gov.cn.zhqfn.cn http://www.morning.pszw.cn.gov.cn.pszw.cn http://www.morning.ktlfb.cn.gov.cn.ktlfb.cn http://www.morning.youyouling.cn.gov.cn.youyouling.cn http://www.morning.qnbgh.cn.gov.cn.qnbgh.cn http://www.morning.dfffm.cn.gov.cn.dfffm.cn http://www.morning.kljhr.cn.gov.cn.kljhr.cn http://www.morning.lkbyj.cn.gov.cn.lkbyj.cn http://www.morning.hmjasw.com.gov.cn.hmjasw.com http://www.morning.rkgyx.cn.gov.cn.rkgyx.cn