gpt4 book ai didi

python - 在 REST API 中哪里可以找到 ELK 版本?

转载 作者:行者123 更新时间:2023-12-01 08:21:03 24 4
gpt4 key购买 nike

我想通过REST API或者解析html获取ELK版本。

我在 API 文档中搜索但没有找到任何内容

重新编辑:在 python 中...我没有发现比

re.findall(r"version":"(\d\.\d\.\d)&quot", requests.get(my_elk).content.decode())[0]

最佳答案

Elasticsearch 提供 JSON,而不是 HTML。所以,你可以使用jq

$ curl -s localhost:9200 | jq '.version.number'
6.6.0

在 Python 中,请不要使用 re 模块...使用 json 模块并实际解析该内容

关于python - 在 REST API 中哪里可以找到 ELK 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54648040/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com