我从 Flurl 开始,我想创建一个 POST,但我认为我的 JSON 参数的格式有问题。
您可以看到 JSON 参数:
{
"aaaUser" : {
"attributes" : {
"name" : "device:domain\\login",
"pwd" : "123456"
}
}
}
Run Code Online (Sandbox Code Playgroud)
这些设置适用于 Postman,现在我想使用 Flurl 来继续我的小 POST :) 但是我的 JSON 格式不正确。
using System.Threading.Tasks;
using Flurl.Http;
namespace Script
{
class Program
{
static async Task Main(string[] args)
{
var result = await "https://IP/api/aaaLogin.json".PostUrlEncodedAsync(new
{
name = "device:domain\\login",
pwd = "123456"
});
}
}
}
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助 !
目前,我从事Flurl的研究,并尝试通过https与API联系(我在实验室中)。因此该证书无效,并且Flurl无法继续工作:/
这是我的错误信息:
Unhandled Exception: System.AggregateException: One or more errors occurred. (Call failed. The SSL connection could not be established, see inner exception. POST https://IP/api/aaaLogin.json) ---> Flurl.Http.FlurlHttpException: Call failed. The SSL connection could not be established, see inner exception. POST https://IP/api/aaaLogin.json ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
Run Code Online (Sandbox Code Playgroud)
在Flurl文档中,我们可以使用using Flurl.Http.Configuration;和修改。DefaultHttpClientFactory但是,我不理解所指定要跳过的元素。
在网络上,我可以看到相同的情况:https : //github.com/tmenier/Flurl/issues/365 您是否对此问题有疑问?
谢谢!
我正在用 Python 启动一个小脚本,以便对我在 Kibana 中进行的查询创建一个小 GET。目前,在 Kibana 中,我收到了包含计数的 IP 列表:

我想用 Python 接收这些信息,我已经尝试过搜索,但我不确定是否理解。
这是 Kibana 中的查询:
GET /_search
{
"size": 0,
"query": {
"range": {
"@timestamp": {
"gte": 1552922613804,
"lte": 1552923513804,
"format": "epoch_millis"
}
}
},
"aggs": {
"2": {
"significant_terms": {
"field": "origin.keyword",
"size": 300
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
是否可以在 python 中创建相同的查询?
提前致谢!
c# ×2
flurl ×2
.net ×1
certificate ×1
json ×1
json.net ×1
kibana ×1
post ×1
python ×1
python-3.x ×1