我试图使一个python脚本使用的请求包,你给予的时间范围和 Jmeter 板ID,你得到的短网址。我现在收到一个201的回复
Elastic目前运行于7.9.1版
贝娄是什么IM发送。这不是我的代码的1对1副本。我把它修剪成最小的需要。同时用X替换一些值
url = "https://SERVER:PORT/api/short_url" # I just copy the printout of the variable how i derive the value make it hard to read but this seems to work as i get a proper response from the server
payload = {
"objects":[
{
"type": "dashboard",
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"rel": "dashboard",
"timeRange":{
"from":"2022-01-01T00:05:00.0831Z",
"to":"2022-02-02T00:05:00.0831Z"
}
}
]
}
response = requests.post(url,json=payload,verify=False)
响应给了我一个201与我复制波纹管的消息
b'{"_index":"api","_type":"short_url","_id":"FwF8fYgBlzSK0Y_fa4q3","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":10,"_primary_term":2}'
Failed to generate a short URL. Error: {"_index":"api","_type":"short_url","_id":"FwF8fYgBlzSK0Y_fa4q3","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":10,"_primary_term":2}
我应该得到一个像这样的“urlId”的响应:“f73b295ff92718b26bc94edac766d8e3”
我现在想的是payload/json不正确或缺少一些值。
谢谢你的帮助
1条答案
按热度按时间mgdq6dx11#
这比使用请求模块要容易得多。试试这个: