python 寫爬蟲的時候出現下面的錯誤:
pyload = {"channelConPosition": "71"}
response = requests.post(url, headers=header, data=pyload)
print(response.json())
{'code': 'C_1', 'data': None, 'message': "請求失敗,JSON parse error: Unrecognized token 'channelConPosition': was expecting ('true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'channelConPosition': was expecting ('true', 'false' or 'null')\n at [Source: [email protected]; line: 1, column: 20]", 'redirectUrl': '', 'searchStatus': 0, 'violationItems': []}
但是在調試之中可以看到如下參數:
所有說應該是有這個參數的,正确的寫法如下:
pyload = {"channelConPosition": "71"}
response = requests.post(url, headers=header, data=json.dumps(pyload))
print(response.json())