美文网首页
json文件的运用(接口自动化)

json文件的运用(接口自动化)

作者: 清水秋香 | 来源:发表于2020-03-14 17:44 被阅读0次

    应用场景:
    1.可将数据存储在json文件中,通过url获取数据,作为mock数据使用:

    #key资源路径 value为需要mock的数据
    "api3/getbanneradvertver2":{"status":0,"data":{"banner":[{"id":2262,"type":6,"type_id":330,"name":"\u524d\u7aef\u4e0b\u4e00\u4ee3\u5f00\u53d1\u8bed\u8a00TypeScript  \u4ece\u57fa\u7840\u5230axios\u5b9e\u6218","pic":"http:\/\/szimg.mukewang.com\/5cf721df09fc2be500000000.jpg","links":""},{"id":1648,"type":6,"type_id":169,"name":"Python3\u5165\u95e8\u673a\u5668\u5b66\u4e60 \u7ecf\u5178\u7b97\u6cd5\u4e0e\u5e94\u7528","pic":"http:\/\/szimg.mukewang.com\/5d0ed2d9085bd6ed09000300.jpg","links":""},{"id":1875,"type":6,"type_id":316,"name":"\u4ece\u57fa\u7840\u5230\u5b9e\u6218 \u624b\u628a\u624b\u5e26\u4f60\u638c\u63e1\u65b0\u7248Webpack4.0","pic":"http:\/\/szimg.mukewang.com\/5d0ed2ca086a9e6f09000300.jpg","links":""},{"id":1999,"type":6,"type_id":342,"name":"\u7eaf\u6b63\u5546\u4e1a\u7ea7\u5e94\u7528 Node.js Koa2\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u670d\u52a1\u7aef","pic":"http:\/\/szimg.mukewang.com\/5ceb5d370955f30f09000300.jpg","links":""},{"id":2158,"type":99,"type_id":0,"name":"Spring Cloud\u5fae\u670d\u52a1\u5f00\u53d1\u5b9e\u8df5","pic":"http:\/\/img2.mukewang.com\/5d088c4009bbebc009000300.jpg","links":"https:\/\/www.imooc.com\/read\/37"},{"id":1709,"type":6,"type_id":354,"name":"Node.js\u5f00\u53d1\u4eff\u77e5\u4e4e\u670d\u52a1\u7aef \u6df1\u5165\u7406\u89e3RESTful API","pic":"http:\/\/szimg.mukewang.com\/5d0ed27508f7d96909000300.jpg","links":""}],"pic":[{"pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/actual_day@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/actual_night@3x.png","type":2},{"pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/path_day@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/path_night@3x.png","type":6},{"pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/question_day@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/question_night@3x.png","type":3},{"pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/note_day@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/note_night@3x.png","type":4},{"pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/discover_day@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/pic\/discover_night@3x.png","type":5}]},"errorCode":1001,"errorDesc":"\u6210\u529f","timestamp":1561269343507},
    "api3/beta4":{"status":1,"data":[{"name":"\u8bfe\u7a0b\u63a8\u8350","pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/recommend@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/recommend_night@3x.png","type":1,"list_type":1,"operate_type":1,"course":[{"id":"1134","name":"\u6781\u901f\u5165\u95e8SpringCloud\u4e4bAPI\u7f51\u5173\u4e0e\u670d\u52a1\u53d1\u73b0","short_description":"SpringCloud\u5fae\u670d\u52a1\u5b9e\u6218\uff0c\u4ece\u67b6\u6784\u5230\u7f51\u5173\u5230\u670d\u52a1\u53d1\u73b0\u3002\r\n","pic":"http:\/\/img3.mukewang.com\/5d0771a608ce48cb02000114-590-330.jpg","numbers":"1270","type":1,"share":"http:\/\/www.imooc.com\/learn\/1134","is_learned":0,"learn_rate":-1,"is_new":1,"level":"\u521d\u7ea7","skill_id":"220","skill_name":"Java","skill_pic":"http:\/\/img2.mukewang.com\/5b17483e00019d4202400240.jpg","skill_color":"ff4545","category_pic":"http:\/\/img2.mukewang.com\/5b1746ca000157da02400240.jpg","course_type":1,"is_learn":0,"bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b","skills":[{"id":"220","name":"Java"},{"id":"5241","name":"Spring Cloud"}]},{"id":"1133","name":"PHP\u52a0\u5bc6","short_description":"\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528\u52a0\u5bc6\uff0c\u8ba9\u6211\u4eec\u5bf9\u5bc6\u7801\u5b66\u6709\u4e2a\u521d\u6b65\u7684\u8ba4\u8bc6\u3002","pic":"http:\/\/img3.mukewang.com\/5d01e4a508f8c1e706000338-590-330.jpg","numbers":"460","type":1,"share":"http:\/\/www.imooc.com\/learn\/1133","is_learned":0,"learn_rate":-1,"is_new":1,"level":"\u4e2d\u7ea7","skill_id":"1","skill_name":"PHP","skill_pic":"http:\/\/img4.mukewang.com\/59c895400001280402400240.jpg","skill_color":"5280f1","category_pic":"http:\/\/img1.mukewang.com\/5b174699000182b802400240.jpg","course_type":1,"is_learn":0,"bgcolor_start":"#ffd273e6","bgcolor_end":"#b3d273e6","skills":[{"id":"1","name":"PHP"}]},{"id":"472","name":"Cocos2d-x\u6e38\u620f\u4e4b\u4e03\u5915\u5973\u795e\u6293\u6355\u8ba1\u5212","short_description":"\u62ef\u6551\u9648\u65e0\u7801\u4ece\u6e38\u620f\u5f00\u53d1\u5f00\u59cb\uff0c\u5982\u679c\u4f60\u60f3\u9006\u88ad\uff0c\u90a3\u4e48\u5feb\u6765\u5b66\u4e60","pic":"http:\/\/img3.mukewang.com\/55c47a0a0001347b06000338-590-330.jpg","numbers":"45138","type":1,"share":"http:\/\/www.imooc.com\/learn\/472","is_learned":0,"learn_rate":-1,"is_new":0,"level":"\u4e2d\u7ea7","skill_id":"1361","skill_name":"Cocos2d-x","skill_pic":"http:\/\/img4.mukewang.com\/5b17497c00016bcf02400240.jpg","skill_color":"17c5bc","category_pic":"http:\/\/img.mukewang.com\/5b1749810001b5a002400240.jpg","course_type":1,"is_learn":0,"skills":[{"id":"1361","name":"Cocos2d-x"},{"id":"1331","name":"C++"}],"bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b"},{"id":"125","name":"Web App\u4e0b\u56fe\u7247\u6ed1\u52a8\u7ec4\u4ef6\u7684\u5f00\u53d1","short_description":"\u672c\u8bfe\u7a0b\u5c31\u662f\u8bb2\u8ff0\u4ece\u96f6\u5f00\u59cb\uff0c\u5982\u4f55\u6784\u5efa\u4e00\u4e2a\u79fb\u52a8\u7aef\u7684\u6ed1\u52a8\u7ec4\u4ef6","pic":"http:\/\/img2.mukewang.com\/5705d0d600013ea906000338-590-330.jpg","numbers":"38332","type":1,"share":"http:\/\/www.imooc.com\/learn\/125","is_learned":0,"learn_rate":-1,"is_new":0,"level":"\u4e2d\u7ea7","skill_id":"1260","skill_name":"WebApp","skill_pic":"http:\/\/img.mukewang.com\/59c896080001e08602400240.jpg","skill_color":"ff5058","category_pic":"http:\/\/img4.mukewang.com\/5b17466a0001bc0c02400240.jpg","course_type":1,"is_learn":0,"bgcolor_start":"#ffff9600","bgcolor_end":"#b3ff9600","skills":[{"id":"1260","name":"WebApp"}]}]},{"name":"\u5c31\u4e1a\u73ed","pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/class@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/class_night@3x.png","type":7,"list_type":2,"operate_type":1,"course":[{"id":"67","name":"\u96f6\u57fa\u7840Java\u5c0f\u767d\u4f53\u9a8c\u8bfe","short_description":"","pic":"http:\/\/climg.mukewang.com\/5c8628560001189f06000338.jpg","numbers":"1296","courses":"4","type":4,"share":"http:\/\/class.imooc.com\/sc\/67","is_learned":0,"learn_rate":-1,"steps":"4","cat_name":"JAVA\u5f00\u53d1\u5de5\u7a0b\u5e08","skill_name":"Android\u653b\u57ce\u72ee","skill_pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/zhiye\/android.png","category_pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/zhiye\/android.png","skill_color":"00B43C","is_new":0,"pay_price":"9.99","discount_type":"1","discount_name":"\u9650\u65f6\u4fc3\u9500","discount_price":"9.99","discount_start_time":"0","discount_end_time":"0","price":4900,"is_buy":0},{"id":"66","name":"\u5165\u95e8\u4e3b\u6d41\u6846\u67b6Scrapy\u4e0e\u722c\u866b\u9879\u76ee\u5b9e\u6218","short_description":"","pic":"http:\/\/climg.mukewang.com\/5c87804700018a9106000338.jpg","numbers":"362","courses":"14","type":4,"share":"http:\/\/class.imooc.com\/sc\/66","is_learned":0,"learn_rate":-1,"steps":"4","cat_name":"Python\u5f00\u53d1\u5de5\u7a0b\u5e08","skill_name":"Android\u653b\u57ce\u72ee","skill_pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/zhiye\/android.png","category_pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/zhiye\/android.png","skill_color":"00B43C","is_new":0,"pay_price":"868","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":86800,"is_buy":0},{"id":"65","name":"\u4ece\u7f51\u9875\u642d\u5efa\u5165\u95e8Python Web","short_description":"","pic":"http:\/\/climg.mukewang.com\/5c87807700013c7906000338.jpg","numbers":"391","courses":"22","type":4,"share":"http:\/\/class.imooc.com\/sc\/65","is_learned":0,"learn_rate":-1,"steps":"4","cat_name":"Python\u5f00\u53d1\u5de5\u7a0b\u5e08","skill_name":"Android\u653b\u57ce\u72ee","skill_pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/zhiye\/android.png","category_pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/zhiye\/android.png","skill_color":"00B43C","is_new":0,"pay_price":"799","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":79900,"is_buy":0}]},{"name":"banner\u5e7f\u544a","pic":"","pic_night":"","type":6,"list_type":1,"operate_type":0,"ads":[{"id":2085,"type":99,"type_id":0,"name":"python","pic":"http:\/\/img3.mukewang.com\/5cd929c5099c98df10530138.jpg","links":"https:\/\/class.imooc.com\/sale\/python"}]},{"name":"\u5b9e\u6218\u63a8\u8350","pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/shizhan@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/shizhan_night@3x.png","type":2,"list_type":1,"operate_type":1,"course":[{"id":"187","name":"SpringCloud  Finchley\u4e09\u7248\u672c(M2+RELEASE+SR2)\u5fae\u670d\u52a1\u5b9e\u6218","order_type":2,"short_description":"\u719f\u7ec3\u4f7f\u7528SpringCloud\u7ec4\u4ef6\u5b9e\u73b0\u5fae\u670d\u52a1\uff0c\u5411\u67b6\u6784\u5e08\u8fc8\u8fdb\uff01\u3010\u5df2\u5347\u7ea7\u81f3Finchley.Release\u3011","pic":"http:\/\/img1.sycdn.imooc.com\/szimg\/5cb68a1408ed350506000338-360-202.jpg","numbers":"4111","type":2,"share":"http:\/\/www.imooc.com\/m\/wap\/shizhan\/classindex.html?cid=187","is_learned":0,"learn_rate":-1,"is_buy":0,"is_new":0,"level":"\u9ad8\u7ea7","skill_id":"220","skill_name":"Java","skill_pic":"http:\/\/img2.mukewang.com\/5b17483e00019d4202400240.jpg","skill_color":"ff4545","category_pic":"http:\/\/img4.mukewang.com\/5b1746ca000157da02400240.jpg","pay_price":"366","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":36600,"course_type":2,"wap":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/187","is_learn":0,"act_name":[],"bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b","skills":[{"id":"220","name":"Java"},{"id":"4737","name":"\u5fae\u670d\u52a1"},{"id":"5241","name":"Spring Cloud"}]},{"id":"160","name":"Python+Django+Ansible Playbook\u81ea\u52a8\u5316\u8fd0\u7ef4\u9879\u76ee\u5b9e\u6218","order_type":2,"short_description":"\u3010\u8bfe\u7a0b\u4ee3\u7801\u5347\u7ea73.6\u7248\u672c\u3011\u963f\u91cc\u5927\u725b\u5168\u9762\u8df5\u884cDevOps\uff0c\u5e26\u4f60\u5f00\u542f\u8fd0\u7ef4\u4e0e\u5f00\u53d1\u95f4\u9ad8\u6548\u534f\u4f5c\u6a21\u5f0f\uff01","pic":"http:\/\/img1.sycdn.imooc.com\/szimg\/5a5334a50001d3dc05400300-360-202.jpg","numbers":"551","type":2,"share":"http:\/\/www.imooc.com\/m\/wap\/shizhan\/classindex.html?cid=160","is_learned":0,"learn_rate":-1,"is_buy":0,"is_new":0,"level":"\u4e2d\u7ea7","skill_id":"1118","skill_name":"Python","skill_pic":"http:\/\/img1.mukewang.com\/59c896b50001942802400240.jpg","skill_color":"0070bb","category_pic":"http:\/\/img2.mukewang.com\/5b1746ed0001976102400240.jpg","pay_price":"388","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":38800,"course_type":2,"wap":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/160","is_learn":0,"act_name":[],"bgcolor_start":"#ff4b96dc","bgcolor_end":"#b34b96dc","skills":[{"id":"1118","name":"Python"},{"id":"5207","name":"\u81ea\u52a8\u5316\u8fd0\u7ef4"}]},{"id":"308","name":"Top\u56e2\u961f\u5927\u725b\u5e26\u4f60\u73a9\u8f6cAndroid\u6027\u80fd\u5206\u6790\u4e0e\u4f18\u5316","order_type":2,"short_description":"\u7531\u8868\u53ca\u91cc\u5b66\u5230\u56fd\u5185Top\u56e2\u961f\u5bf9\u6027\u80fd\u95ee\u9898\u7684\u4f53\u7cfb\u4f18\u5316\u65b9\u6848\u3001\u624b\u6bb5\u53ca\u4fdd\u969c\u7ecf\u9a8c","pic":"http:\/\/img1.sycdn.imooc.com\/szimg\/5c26f19508ce8c8100000000-360-202.jpg","numbers":"527","type":2,"share":"http:\/\/www.imooc.com\/m\/wap\/shizhan\/classindex.html?cid=308","is_learned":0,"learn_rate":-1,"is_buy":0,"is_new":0,"level":"\u9ad8\u7ea7","skill_id":"223","skill_name":"Android","skill_pic":"http:\/\/img4.mukewang.com\/5b18943b00018ba502400240.jpg","skill_color":"00b85a","category_pic":"http:\/\/img3.mukewang.com\/5b1747e50001d45c02400240.jpg","pay_price":"288","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":28800,"course_type":2,"wap":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/308","is_learn":0,"act_name":[],"bgcolor_start":"#ff00b95a","bgcolor_end":"#b300b95a","skills":[{"id":"223","name":"Android"}]},{"id":"274","name":"MySQL\u6570\u636e\u5e93\u96c6\u7fa4-PXC\u65b9\u6848","order_type":2,"short_description":"\u5b66\u4e60PXC\uff0c\u6253\u9020\u9ad8\u4ef7\u503c\u7684MySQL\u96c6\u7fa4","pic":"http:\/\/img1.sycdn.imooc.com\/szimg\/5b8e74ac00019f7d05400300-360-202.jpg","numbers":"238","type":2,"share":"http:\/\/www.imooc.com\/m\/wap\/shizhan\/classindex.html?cid=274","is_learned":0,"learn_rate":-1,"is_buy":0,"is_new":0,"level":"\u4e2d\u7ea7","skill_id":"952","skill_name":"MySQL","skill_pic":"http:\/\/img2.mukewang.com\/5b17498d0001b07f02400240.jpg","skill_color":"5892ee","category_pic":"http:\/\/img1.mukewang.com\/5b1749940001ab5a02400240.jpg","pay_price":"299","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":29900,"course_type":2,"wap":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/274","is_learn":0,"act_name":[],"bgcolor_start":"#ff4b96dc","bgcolor_end":"#b34b96dc","skills":[{"id":"952","name":"MySQL"}]},{"id":"167","name":"BAT\u5927\u725b\u4eb2\u6388 \u57fa\u4e8eElasticSearch\u7684\u641c\u623f\u7f51\u5b9e\u6218 ","order_type":2,"short_description":"ES+MySQL+Kafka\uff0c\u7ed3\u5408\u767e\u5ea6\u5730\u56fe\u3001ELK\u7b49\u5b9e\u8df5ES\u9ad8\u7ea7\u5e94\u7528\uff0c\u6253\u9020\u5f3a\u529b\u7ad9\u5185\u641c\u7d22","pic":"http:\/\/img1.sycdn.imooc.com\/szimg\/5a308c9400011c1305400300-360-202.jpg","numbers":"669","type":2,"share":"http:\/\/www.imooc.com\/m\/wap\/shizhan\/classindex.html?cid=167","is_learned":0,"learn_rate":-1,"is_buy":0,"is_new":0,"level":"\u9ad8\u7ea7","skill_id":"220","skill_name":"Java","skill_pic":"http:\/\/img2.mukewang.com\/5b17483e00019d4202400240.jpg","skill_color":"ff4545","category_pic":"http:\/\/img.mukewang.com\/5b1746ca000157da02400240.jpg","pay_price":"348","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":34800,"course_type":2,"wap":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/167","is_learn":0,"act_name":[],"bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b","skills":[{"id":"220","name":"Java"},{"id":"1359","name":"\u5927\u6570\u636e"}]},{"id":"208","name":"MyCAT+MySQL\u642d\u5efa\u9ad8\u53ef\u7528\u4f01\u4e1a\u7ea7\u6570\u636e\u5e93\u96c6\u7fa4","order_type":2,"short_description":"\u56fd\u5185\u9876\u7ea7DBA\u4eb2\u6388\uff0c\u7cbe\u8bb2\u4f01\u4e1a\u7ea7MyCAT\u5e94\u7528\uff0c\u8be6\u89e3\u4e1a\u52a1\u6570\u636e\u5e93\u5206\u5e93\u5206\u8868\u3001\u8bfb\u5199\u5206\u79bb","pic":"http:\/\/img1.sycdn.imooc.com\/szimg\/5ad5568300018ede05400300-360-202.jpg","numbers":"455","type":2,"share":"http:\/\/www.imooc.com\/m\/wap\/shizhan\/classindex.html?cid=208","is_learned":0,"learn_rate":-1,"is_buy":0,"is_new":0,"level":"\u4e2d\u7ea7","skill_id":"952","skill_name":"MySQL","skill_pic":"http:\/\/img2.mukewang.com\/5b17498d0001b07f02400240.jpg","skill_color":"5892ee","category_pic":"http:\/\/img1.mukewang.com\/5b1749940001ab5a02400240.jpg","pay_price":"199","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":19900,"course_type":2,"wap":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/208","is_learn":0,"act_name":[],"bgcolor_start":"#ff4b96dc","bgcolor_end":"#b34b96dc","skills":[{"id":"952","name":"MySQL"}]}]},{"name":"\u65b0\u8bfe\u4e0a\u67b6","pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/new_course@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/new_course_night@3x.png","type":3,"list_type":2,"operate_type":0,"course":[{"id":"37","name":"\u6d4b\u8bd5\u8bfe\u7a0b\uff08\u8bf7\u52ff\u8d2d\u4e70\uff09","bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b","skills":[{"id":"4737","name":"\u5fae\u670d\u52a1"}],"short_description":"\u6d4b\u8bd5\u8bfe\u7a0b\uff08\u8bf7\u52ff\u8d2d\u4e70\uff091122","numbers":"11","ordertype":2,"pic":"\/\/img1.sycdn.imooc.com\/szimg\/5af2b85e000134d112000675-360-202.jpg","price":100,"type":2,"is_learned":0,"is_buy":0,"share":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/37"},{"id":"353","name":"\u963f\u91cc\u65b0\u96f6\u552e\u6570\u636e\u5e93\u8bbe\u8ba1\u4e0e\u5b9e\u6218 ","bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b","skills":[{"id":"220","name":"Java"},{"id":"952","name":"MySQL"}],"short_description":"\u6570\u636e\u5e93\u662f\u5f00\u53d1\u4eba\u5458\u7684\u5fc5\u4fee\u8bfe\uff0c\u89e3\u9501\u201c\u65b0\u96f6\u552e\u201d\u4e1a\u52a1\u8ba9\u6570\u636e\u5e93\u5b9e\u6218\u80fd\u529b\u518d\u4e0a\u4e00\u5c42\u697c","numbers":"243","ordertype":2,"pic":"\/\/img1.sycdn.imooc.com\/szimg\/5d08d0b308c9749706000338-360-202.jpg","price":28800,"type":2,"is_learned":0,"is_buy":0,"share":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/353"},{"id":"359","name":"Web\u81ea\u52a8\u5316\u6d4b\u8bd5 Selenium\u57fa\u7840\u5230\u4f01\u4e1a\u5b9e\u9645\u5e94\u7528","bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b","skills":[{"id":"5265","name":"\u81ea\u52a8\u5316\u6d4b\u8bd5"}],"short_description":"\u6210\u4e3aWeb\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u7a0b\u5e08\u7684\u5fc5\u5907\u8bfe\u7a0b","numbers":"14","ordertype":2,"pic":"\/\/img1.sycdn.imooc.com\/szimg\/5d0356e3085c9d4606000338-360-202.jpg","price":26600,"type":2,"is_learned":0,"is_buy":0,"share":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/359"}]},{"name":"\u6155\u8bfe\u7cbe\u82f1\u540d\u5e08\u63a8\u8350","pic":"","pic_night":"","type":5,"list_type":2,"operate_type":0,"teachers":[{"uid":"2155343","nickname":"\u626c\u5e06\u8fdc\u822a_","aboutme":"\u62e5\u6709\u591a\u5e74\u5e26\u9886\u534e\u4e3a\u6570\u636e\u6316\u6398\u56e2\u961f\u7ed9\u5168\u4e16\u754c\u8303\u56f4\u5185\u8457\u540d\u8fd0\u8425\u5546\u63d0\u4f9b\u5927\u6570\u636e\u89e3\u51b3\u65b9\u6848\u7684\u7ecf\u9a8c\uff0c\u5de5\u4f5c\u4e2d\u6240\u5e26\u9886\u7684\u56e2\u961f\u4e3b\u8981\u8d1f\u8d23\u5904\u7406\u3001\u6316\u6398\u548c\u5206\u6790\u6bcf\u5929\u6570\u4ee5TB\u8ba1\u7684\u6570\u636e\u3002\u4f5c\u4e3a\u4e00\u4e2a\u5e26\u9886\u62e5\u670920\u4eba\u56e2\u961f\u6210\u529f\u5b8c\u6210\u591a\u4e2a\u5168\u7403\u9879\u76ee\u7684leader,\u975e\u5e38\u4e86\u89e3\u5f53\u4eca\u7528\u9014\u6700\u5e7f\u6cdb\u7684\u6570\u636e\u6316\u6398\u3001\u673a\u5668\u5b66\u4e60\u548c\u6570\u7406\u7edf\u8ba1\u65b9\u6cd5,\u540c\u65f6\u6709\u7740\u591a\u5e74\u719f\u7ec3\u5e94\u7528\u5404\u79cd\u6570\u636e\u6316\u6398\u5e73\u53f0\u5de5\u5177\u548c\u6570\u7406\u7edf\u8ba1\u5305(\u4f8b\u5982R,python\u548cSpark)\u7ecf\u9a8c\u3002","portrait":"545850bb0001979202200220","job_title":"\u6570\u636e\u79d1\u5b66\u5bb6","img":"http:\/\/img1.mukewang.com\/545850bb0001979202200220-100-100.jpg","pic":"http:\/\/img1.mukewang.com\/545850bb0001979202200220-370-370.jpg"},{"uid":"4379042","nickname":"\u7f16\u7a0b\u6d6a\u5b50","aboutme":"\u4e92\u8054\u7f51\u642c\u7816\u5c0f\u738b\u5b50\uff0c\u4ece\u4e8b\u4e92\u8054\u7f51web \u5f00\u53d16\u5e74\uff0c\u70ed\u7231\u642c\u7816\u884c\u4e1a\uff0c\u6709\u4ee3\u7801\u6d01\u7656\uff0c\u5bf9PHP\uff0cPython\uff0cJava\u90fd\u6709\u6d89\u730e\uff0c \u5b9e\u8df5\u7ecf\u9a8c\u4e30\u5bcc\uff0c\u5bcc\u6709\u6fc0\u60c5\uff0c\u70ed\u7231\u5206\u4eab\uff0c\u4e50\u89c2\u5f00\u6717\uff0c\u559c\u6b22\u4e13\u7814\u65b0\u6280\u672f","portrait":"583e9afa000166c410240770","job_title":"PHP\u5f00\u53d1\u5de5\u7a0b\u5e08","img":"http:\/\/img2.mukewang.com\/583e9afa000166c410240770-100-100.jpg","pic":"http:\/\/img1.mukewang.com\/583e9afa000166c410240770-370-370.jpg"},{"uid":"5245191","nickname":"DocMike","aboutme":"\u5b89\u5353\u5de5\u7a0b\u5e08  \u591a\u5e74\u5f00\u53d1\u548c\u5e26\u56e2\u961f\u7ecf\u9a8c\uff0c\u66fe\u5728BAT\u7b49\u591a\u5bb6\u4e00\u7ebf\u4e92\u8054\u7f51\u516c\u53f8\u5c31\u804c\uff0cP\u5927\u7855\u58eb\u6bd5\u4e1a\uff0c\u5e94\u5c4a\u751f\u5bfc\u5e08\u3001\u6821\u62db\u3001\u793e\u62db\u9762\u8bd5\u5b98\uff0c\u4e3b\u5bfc\u4e0e\u5f00\u53d1\u8fc7\u591a\u6b3e\u77e5\u540d\u7684\u4e92\u8054\u7f51\u91d1\u878d\u3001\u514d\u8d39\u56fd\u9645\u7535\u8bdd\u3001\u5916\u5356\u7b49\u9879\u76ee\u7684\u67b6\u6784\u4e0e\u5f00\u53d1","portrait":"590b09de0001503904000400","job_title":"\u79fb\u52a8\u5f00\u53d1\u5de5\u7a0b\u5e08","img":"http:\/\/img3.mukewang.com\/590b09de0001503904000400-100-100.jpg","pic":"http:\/\/img.mukewang.com\/590b09de0001503904000400-370-370.jpg"},{"uid":"3017249","nickname":"ustbhuangyi","aboutme":"\u5317\u4eac\u79d1\u6280\u5927\u5b66\u8ba1\u7b97\u673a\u4e13\u4e1a\u7855\u58eb\u3002\u66fe\u4efb\u804c\u767e\u5ea6\uff0c\u73b0\u5c31\u804c\u6ef4\u6ef4\uff0c\u524d\u7aef\u6280\u672f\u4e13\u5bb6\u3002\u5bf9Vue.js\u6709\u5f88\u6df1\u7684\u7406\u89e3\uff0c\u662f\u300aVue.js\u6743\u5a01\u6307\u5357\u300b\u4e00\u4e66\u7684\u4e3b\u8981\u4f5c\u8005\u3002\u4ed6\u6709\u7740\u6559\u79d1\u4e66\u5f0f\u7684\u4ee3\u7801\u5199\u4f5c\u4e60\u60ef\uff0c\u5bf9\u4ee3\u7801\u6709\u6d01\u7656\uff0c\u8ffd\u6c42\u9ad8\u8d28\u91cf\u7684\u4ee3\u7801\u3002\u5f3a\u5316\u63d0\u5347\u7f16\u5199\u9ad8\u53ef\u6269\u5c55\uff0c\u901a\u7528\u6027\u5f3a\u7684\u4ee3\u7801\u7684\u80fd\u529b","portrait":"577baef700019c4501400140","job_title":"\u6ef4\u6ef4\u524d\u7aef\u6280\u672f\u4e13\u5bb6","img":"http:\/\/img1.mukewang.com\/577baef700019c4501400140-100-100.jpg","pic":"http:\/\/img4.mukewang.com\/577baef700019c4501400140-370-370.jpg"},{"uid":"5027812","nickname":"\u5feb\u4e50\u52a8\u8d77\u6765\u5440","aboutme":"7\u5e74\u5de5\u4f5c\u7ecf\u9a8c\u7684\u8d44\u6df1\u524d\u7aef\u5de5\u7a0b\u5e08\uff0c\u4e3b\u8981\u4ece\u4e8bWeb\u89c6\u9891\u9886\u57df\u7684\u5e95\u5c42\u5f00\u53d1\u3002\u5148\u540e\u5728360\u3001\u53bb\u54ea\u513f\u7f51\u3001\u67d0\u77e5\u540d\u89c6\u9891\u516c\u53f8\u5de5\u4f5c\u3002\u5148\u540e\u8f93\u51fa\u300aES6\u96f6\u57fa\u7840\u6559\u5b66 \u89e3\u6790\u5f69\u7968\u9879\u76ee\u300b\u3001\u300a\u524d\u7aef\u8df3\u69fd\u9762\u8bd5\u5fc5\u5907\u6280\u5de7\u300b\u3001\u300a\u524d\u7aef\u9762\u8bd5\u9879\u76ee\u51b2\u523a\uff0c\u4eac\u4e1c\u91d1\u878dVue\u7ec4\u4ef6\u5316\u5b9e\u6218\u300b\u7b49\u8bfe\u7a0b","portrait":"54584cb50001e5b302200220","job_title":"Web\u524d\u7aef\u5de5\u7a0b\u5e08","img":"http:\/\/img2.mukewang.com\/54584cb50001e5b302200220-100-100.jpg","pic":"http:\/\/img2.mukewang.com\/54584cb50001e5b302200220-370-370.jpg"}]},{"name":"\u731c\u4f60\u559c\u6b22","pic":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/guess_love@3x.png","pic_night":"http:\/\/www.imooc.com\/static\/img\/andriod\/icon\/guess_love_night@3x.png","type":4,"list_type":1,"operate_type":2,"course":[{"id":"790","name":"django\u5165\u95e8\u4e0e\u5b9e\u8df5","short_description":"\u624b\u628a\u624b\u5e26\u4f60\u8fdb\u5165Django\u5f00\u53d1\u7684\u5927\u95e8\uff0c\u5145\u5206\u9886\u7565Django\u7684\u9b45\u529b","pic":"http:\/\/img.mukewang.com\/586f60d90001776a06000338-590-330.jpg","numbers":"58382","type":1,"share":"http:\/\/www.imooc.com\/learn\/790","is_learned":0,"learn_rate":-1,"is_new":0,"level":"\u521d\u7ea7","skill_id":"1118","skill_name":"Python","skill_pic":"http:\/\/img3.mukewang.com\/59c896b50001942802400240.jpg","skill_color":"0070bb","category_pic":"http:\/\/img4.mukewang.com\/5b1746ed0001976102400240.jpg","course_type":1,"is_learn":0,"bgcolor_start":"#ff4b96dc","bgcolor_end":"#b34b96dc","skills":[{"id":"1118","name":"Python"},{"id":"4905","name":"Django"}]},{"id":"62","name":"\u4fe1\u606f\u6392\u5217\u6548\u679c","short_description":"\u5927\u5496\u6559\u60a8\u8282\u7ea6\u7f51\u9875\u7a7a\u95f4\u7684\u65b9\u6cd5\uff0c\u5feb\u901f\u5b66\u4f1a\u4fe1\u606f\u6392\u5217\u6548\u679c\u7684\u5236\u4f5c","pic":"http:\/\/img3.mukewang.com\/574673940001426706000338-590-330.jpg","numbers":"32145","type":1,"share":"http:\/\/www.imooc.com\/learn\/62","is_learned":0,"learn_rate":-1,"is_new":0,"level":"\u521d\u7ea7","skill_id":"44","skill_name":"JavaScript","skill_pic":"http:\/\/img1.mukewang.com\/5b1893fd00017f4902400240.jpg","skill_color":"eb3030","category_pic":"http:\/\/img4.mukewang.com\/5b1893f90001d25702400240.jpg","course_type":1,"is_learn":0,"bgcolor_start":"#ffd273e6","bgcolor_end":"#b3d273e6","skills":[{"id":"44","name":"JavaScript"}]},{"id":"640","name":"R\u8bed\u8a00\u4e4b\u6570\u636e\u53ef\u89c6\u5316","short_description":"R\u8bed\u8a00\u4e09\u5927\u7ed8\u56fe\u7cfb\u7edf\uff0c\u7528\u56fe\u5f62\u76f4\u89c2\u63a2\u7d22\u6570\u636e\u3001\u53d1\u73b0\u6709\u4ef7\u503c\u4fe1\u606f","pic":"http:\/\/img3.mukewang.com\/56f8a3a50001f03406000338-590-330.jpg","numbers":"34160","type":1,"share":"http:\/\/www.imooc.com\/learn\/640","is_learned":0,"learn_rate":-1,"is_new":0,"level":"\u4e2d\u7ea7","skill_id":"1359","skill_name":"\u5927\u6570\u636e","skill_pic":"http:\/\/img3.mukewang.com\/5b174aa700017b6102400240.jpg","skill_color":"1679d3","category_pic":"http:\/\/img.mukewang.com\/5b174aae00016dda02400240.jpg","course_type":1,"is_learn":0,"skills":[{"id":"1359","name":"\u5927\u6570\u636e"}],"bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b"},{"id":"214","name":"\u6a21\u5f0f\u7684\u79d8\u5bc6---\u4ee3\u7406\u6a21\u5f0f","short_description":"\u672c\u8282\u8bfe\u7a0b\u5c06\u5e26\u4f60\u9886\u7565Java\u7f16\u7a0b\u8bed\u8a00\u4e2d\u4ee3\u7406\u6a21\u5f0f\u7684\u5965\u5999","pic":"http:\/\/img1.mukewang.com\/572afd6000019e1f06000338-590-330.jpg","numbers":"50839","type":1,"share":"http:\/\/www.imooc.com\/learn\/214","is_learned":0,"learn_rate":-1,"is_new":0,"level":"\u4e2d\u7ea7","skill_id":"220","skill_name":"Java","skill_pic":"http:\/\/img1.mukewang.com\/5b17483e00019d4202400240.jpg","skill_color":"ff4545","category_pic":"http:\/\/img4.mukewang.com\/5b1746ca000157da02400240.jpg","course_type":1,"is_learn":0,"bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b","skills":[{"id":"220","name":"Java"}]},{"id":"262","name":"RabbitMQ\u6d88\u606f\u4e2d\u95f4\u4ef6\u6280\u672f\u7cbe\u8bb2","order_type":2,"short_description":"\u4ece0\u52301\uff0c\u5168\u9762\u6df1\u5165\u638c\u63e1RabbitMQ\u6d88\u606f\u4e2d\u95f4\u4ef6\u6280\u672f","pic":"http:\/\/img1.sycdn.imooc.com\/szimg\/5b6015ac00011ca105400300-360-202.jpg","numbers":"824","type":2,"share":"http:\/\/www.imooc.com\/m\/wap\/shizhan\/classindex.html?cid=262","is_learned":0,"learn_rate":-1,"is_buy":0,"is_new":0,"level":"\u4e2d\u7ea7","skill_id":"220","skill_name":"Java","skill_pic":"http:\/\/img2.mukewang.com\/5b17483e00019d4202400240.jpg","skill_color":"ff4545","category_pic":"http:\/\/img2.mukewang.com\/5b1746ca000157da02400240.jpg","pay_price":"348","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":34800,"course_type":2,"wap":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/262","is_learn":0,"act_name":[],"bgcolor_start":"#ffff739b","bgcolor_end":"#b3ff739b","skills":[{"id":"220","name":"Java"},{"id":"4903","name":"SpringBoot"}]},{"id":"225","name":"HTTP\u534f\u8bae\u539f\u7406+\u5b9e\u8df5Web\u5f00\u53d1\u5de5\u7a0b\u5e08\u5fc5\u5b66","order_type":2,"short_description":"\u89e3\u6790HTTP\u534f\u8bae\u539f\u7406 \u592f\u5b9eHTTP\u6280\u672f\u57fa\u7840 \u6253\u901a\u524d\u540e\u7aef\u52a9\u4f60\u5feb\u901f\u6210\u957f","pic":"http:\/\/img1.sycdn.imooc.com\/szimg\/5b0cb5df00016e5405400300-360-202.jpg","numbers":"2593","type":2,"share":"http:\/\/www.imooc.com\/m\/wap\/shizhan\/classindex.html?cid=225","is_learned":0,"learn_rate":-1,"is_buy":0,"is_new":0,"level":"\u4e2d\u7ea7","skill_id":"44","skill_name":"JavaScript","skill_pic":"http:\/\/img.mukewang.com\/5b1893fd00017f4902400240.jpg","skill_color":"eb3030","category_pic":"http:\/\/img.mukewang.com\/5b1893f90001d25702400240.jpg","pay_price":"99","discount_type":0,"discount_name":"","discount_price":"","discount_start_time":0,"discount_end_time":0,"price":9900,"course_type":2,"wap":"http:\/\/coding.imooc.com\/wap\/classindex\/cid\/225","is_learn":0,"act_name":[],"bgcolor_start":"#ffd273e6","bgcolor_end":"#b3d273e6","skills":[{"id":"44","name":"JavaScript"},{"id":"222","name":"Node.js"}]}]}],"errorCode":1000,"errorDesc":"\u6210\u529f","timestamp":1561274618249}
    

    json文件的读取

    import json
    def read_json(file_name='xxx'):
        with open(file_name) as f:
            data = json.load(f)
        return data
    
    def get_value(key,file_name):
        data = read_json(file_name)
        return data.get(key)
    

    2.通过code判断,message是否正确,目的是code和message同时验证

    {
      "api3/getbanneradvertver2":[
            {"1006":"token error"},
            {"10001":"用户名错误"},
            {"10002":"密码错误"}
      ],
      "api3/beta4":[
            {"1006":"登陆成功"},
            {"10001":"用户名错误"},
            {"10002":"密码错误"}
      ]
    }
    

    获取message

    import json
    def read_json(file_name='xxx'):
        with open(file_name) as f:
            data = json.load(f)
        return data
    
    def get_value(key,file_name):
        data = read_json(file_name)
        return data.get(key)
    
    def handle_result_message(url,code):
        data = get_value(url,'/Users/wgz/Desktop/mocktest/Excel封装/Config/code_message.json')
        if data:
            for i in data:
                if i.get(code):
                    return i.get(code)
    

    相关文章

      网友评论

          本文标题:json文件的运用(接口自动化)

          本文链接:https://www.haomeiwen.com/subject/ovjgshtx.html