检查一下:def CreateNewCustomeByRequestsPOST(cookies): url = "https://crm.baidu.com/polaris-web/sme-cust/addCust/add" data = { "custBaseInfo": { "custType": "0", "custName": "上海曜纵科技有限公司", "company": "", "custSource1": "1", "custSource2": "108", "provinceId": "31", "cityId": "39", "countryId": "459", "tradeType": "51", "firstTradeId": 2031, "secondTradeId": 203101, "remark": "", "regionValue": [ "31", "39", "459" ], "tradeValue": [ 2031, 203101 ] }, "contacts": [ { "contactBaseInfo": { "name": "wef", "gender": "1", "duty": "", "remark": "", "state": 1 }, "contactWays": [ { "contactType": 0, "contactInfo": "12365548975", "state": 0, "countryCode": 86 } ], "phoneList": [ { "contactType": 0, "contactInfo": "12365548975", "state": 0, "countryCode": 86 } ], "telList": [ { "contactType": 1, "contactInfo": "", "state": 0, "countryCode": 86, "areaCode": "", "extInfo": "" } ], "emailList": [ { "contactType": 6, "contactInfo": "", "state": 0 } ] } ], "websites": [], "addresses": [], "custpoolId": "" } res = requests.post(url, data=data, cookies=cookies) return res
时间: 2023-06-28 09:14:34 浏览: 154
根据你提供的代码,data 中的 "regionValue" 和 "tradeValue" 对应的值都是列表类型,但是在接口文档中并没有要求传入列表类型,可能是因为这个原因导致了错误。建议你修改为字符串类型,如下所示:
```python
data = {
"custBaseInfo": {
"custType": "0",
"custName": "上海曜纵科技有限公司",
"company": "",
"custSource1": "1",
"custSource2": "108",
"provinceId": "31",
"cityId": "39",
"countryId": "459",
"tradeType": "51",
"firstTradeId": "2031", # 修改为字符串类型
"secondTradeId": "203101", # 修改为字符串类型
"remark": "",
"regionValue": "31,39,459", # 修改为字符串类型
"tradeValue": "2031,203101" # 修改为字符串类型
},
"contacts": [
{
"contactBaseInfo": {
"name": "wef",
"gender": "1",
"duty": "",
"remark": "",
"state": 1
},
"contactWays": [
{
"contactType": 0,
"contactInfo": "12365548975",
"state": 0,
"countryCode": 86
}
],
"phoneList": [
{
"contactType": 0,
"contactInfo": "12365548975",
"state": 0,
"countryCode": 86
}
],
"telList": [
{
"contactType": 1,
"contactInfo": "",
"state": 0,
"countryCode": 86,
"areaCode": "",
"extInfo": ""
}
],
"emailList": [
{
"contactType": 6,
"contactInfo": "",
"state": 0
}
]
}
],
"websites": [],
"addresses": [],
"custpoolId": ""
}
```
修改后再试试看是否能够正常运行。
阅读全文