python接口自动化入参json传参遇到转义字符

Posted 2chun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python接口自动化入参json传参遇到转义字符相关的知识,希望对你有一定的参考价值。

入参:application/json格式

{"district":"","activityId":"","city":"闵行区","districtId":0,"channel":"JIOS","payMethod":1,"provinceId":0,"ShopId":"38","province":"上海市","cityId":0,"pageIndex":1,"Products":"[   {     "ActivityId" : "",     "ProductId" : "TR-BS-TECHNO",     "InstallShopId" : "",     "ServiceId" : "",     "Quantity" : 2,     "VariantId" : "15",     "InstallShop" : ""   },   {     "ActivityId" : "",     "InstallShopId" : "38",     "ServiceId" : "FU-TUHU-LUTAI|1",     "ProductId" : "FU-TUHU-LUTAI",     "VariantId" : "1",     "Quantity" : 2,     "InstallShop" : "(仙霞小周)"   },   {     "Quantity" : 1,     "ProductId" : "FU-TUHU-MFQCJC",     "ActivityId" : "",     "InstallShopId" : "38",     "InstallShop" : "(仙霞小周)",     "VariantId" : "1",     "ServiceId" : "FU-TUHU-MFQCJC|1"   } ]","orderType":"Tires","isInstall":"true"}

①转义字符存在“”,与前面的“”重复,转成’单引号

②去掉

以上是关于python接口自动化入参json传参遇到转义字符的主要内容,如果未能解决你的问题,请参考以下文章

url传参包含json

URL 传参转义 (特殊符号转义)

IE URL传参问题

IE URL传参问题

IE URL传参问题

python接口自动化3-发送post及其他请求