我尝试使用请求模块发布数据。这是代码,
var requestInfo = {
tags: [
{
"name": 'UIW_IWIWU',
"filters": {
"attributes": {
"VesselId": '2982'
}
},
"order": "asc"
}
],
start: "15mi-ago",
end: "30ms-ago"
};
request.post({
uri:'http://localhost:3000/data-api',
json: 'true',
body: requestInfo
},function (error, response, body) {
res.send(response);
}
);
上面的代码会在终端中抛出JSON无效错误。
Error: Invalid json
这是堆栈跟踪:
Error: invalid json
at parse (D:\Working\branches\Smartship-SNG_Demo\node_modules\body-parser\li
b\types\json.js:83:15)
at D:\Working\branches\Smartship-SNG_Demo\node_modules\body-parser\lib\read.
js:108:18
at invokeCallback (D:\Working\branches\Smartship-SNG_Demo\node_modules\raw-b
ody\index.js:262:16)
at done (D:\Working\branches\Smartship-SNG_Demo\node_modules\raw-body\index.
js:251:7)
at IncomingMessage.onEnd (D:\Working\branches\Smartship-SNG_Demo\node_module
s\raw-body\index.js:307:7)
at emitNone (events.js:86:13)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
答案 0 :(得分:1)
请检查JSON结构
JSON键必须是String
更新JSON结构
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Firefox()
browser.get('http://www.acquirersmultiple.com/login/')
#login_user = browser.find_element_by_css_selector('.rcp_login_data > p:nth-child(1) > input:nth-child(2)')
username = browser.find_element_by_id("rcp_user_login")
password = browser.find_element_by_id('rcp_user_pass')
username.send_keys("SomeUser")
password.send_keys("P4s5word")