当前位置: 首页 > news >正文

博物馆网站建设方案免费开放代理

博物馆网站建设方案,免费开放代理,全网推广品牌公司,阿里云买了域名怎么建网站在我们经常调试微服务或者使用 Elasticsearch API 时#xff0c;经常会使用curl 来进行调试。但是有时我们的输出不尽如意。显示的不是一 pretty 格式进行输出的。我们有时还必须借助于其他的一些网站工具#xff0c;比如 Best JSON Formatter and JSON Validator: Online JS…在我们经常调试微服务或者使用 Elasticsearch API 时经常会使用curl 来进行调试。但是有时我们的输出不尽如意。显示的不是一 pretty 格式进行输出的。我们有时还必须借助于其他的一些网站工具比如 Best JSON Formatter and JSON Validator: Online JSON Formatter  或者 JSON Formatter Validator 来帮我来验证。 在 Elasticsearch 的输出中经常我们会看到如下格式的命令 curl -k -u elastic:gV4pgxNCTi5y*80GmoqN https://localhost:9200?prettytrue 这里的 pretty 就是要求我们要以 JSON 的格式来进行显示。尽管我们上面的命令可以省去 prettytrue 这个选项可以还是可以得到漂亮的输出 curl -k -u elastic:gV4pgxNCTi5y*80GmoqN https://localhost:9200 {name : liuxgm.local,cluster_name : elasticsearch,cluster_uuid : xz4jLE_USfmbvkSyvG138w,version : {number : 8.6.1,build_flavor : default,build_type : tar,build_hash : 180c9830da956993e59e2cd70eb32b5e383ea42c,build_date : 2023-01-24T21:35:11.506992272Z,build_snapshot : false,lucene_version : 9.4.2,minimum_wire_compatibility_version : 7.17.0,minimum_index_compatibility_version : 7.0.0},tagline : You Know, for Search } 我们可以看如下的命令的输出 curl -k https://localhost:9200?prettytrue curl -k https://localhost:9200?prettytrue {error : {root_cause : [{type : security_exception,reason : missing authentication credentials for REST request [/?prettytrue],header : {WWW-Authenticate : [Basic realm\security\ charset\UTF-8\,Bearer realm\security\,ApiKey]}}],type : security_exception,reason : missing authentication credentials for REST request [/?prettytrue],header : {WWW-Authenticate : [Basic realm\security\ charset\UTF-8\,Bearer realm\security\,ApiKey]}},status : 401 } 我们可以看到很漂亮的输出。一旦我们省去 prettytrue 这个选项那么我们看看输出的结果是什么 $ curl -k https://localhost:9200 {error:{root_cause:[{type:security_exception,reason:missing authentication credentials for REST request [/],header:{WWW-Authenticate:[Basic realm\security\ charset\UTF-8\,Bearer realm\security\,ApiKey]}}],type:security_exception,reason:missing authentication credentials for REST request [/],header:{WWW-Authenticate:[Basic realm\security\ charset\UTF-8\,Bearer realm\security\,ApiKey]}},status:401}$ 很显然我们的显示非常不漂亮很难看懂它的意思。 在 Elasticsearch 中我们的很多命令都可以使用 prettytrue 选项来变得更加美观。 但是在实际的用例中有很多并不像 Elasticsearch 那样。它们的命令中并没有像 Elasticsearch 那样提供 prettytrue 这样的选项。那么我们该怎么办呢 在下面我来介绍几种方案 使用 json_pp 我们尝试使用如下的命令 echo {type:Bar,id:1,title:Foo} | json_pp -json_opt pretty,canonical $ echo {type:Bar,id:1,title:Foo} | json_pp -json_opt pretty,canonical {id : 1,title : Foo,type : Bar }很显然它能帮我们把 JSON 的输出变得很漂亮。我们来尝试一下上面的 Elasticsearch 访问 $ curl -k https://localhost:9200 | json_pp -json_opt pretty,canonical% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed 100 459 100 459 0 0 29436 0 --:--:-- --:--:-- --:--:-- 38250 {error : {header : {WWW-Authenticate : [Basic realm\security\ charset\UTF-8\,Bearer realm\security\,ApiKey]},reason : missing authentication credentials for REST request [/],root_cause : [{header : {WWW-Authenticate : [Basic realm\security\ charset\UTF-8\,Bearer realm\security\,ApiKey]},reason : missing authentication credentials for REST request [/],type : security_exception}],type : security_exception},status : 401 } 很显然它也工作正常。 使用 jq 我们需要单独安装 jq。我们使用如下的命令来进行验证 echo {type:Bar,id:1,title:Foo} | jq . $ echo {type:Bar,id:1,title:Foo} | jq . {type: Bar,id: 1,title: Foo } 显然这种方法比上面的方法更为简洁。我们也可以使用它来试一下 Elasticsearch 的访问 curl -k https://localhost:9200 | jq . 它还有彩色的输出。显得非常漂亮。 使用 python 我们使用如下的例子来进行展示 echo {type:Bar,id:1,title:Foo} | python -m json.tool $ echo {type:Bar,id:1,title:Foo} | python -m json.tool {type: Bar,id: 1,title: Foo } 尝试一下 Elasticsearch API 它和 jq 输出的结果很相似除了没有彩色的显示。 我们还可以使用 curljson 命令 pip install curljson curljson -k https://localhost:9200 {error: {header: {WWW-Authenticate: [Basic realm\security\ charset\UTF-8\,Bearer realm\security\,ApiKey]},reason: missing authentication credentials for REST request [/],root_cause: [{header: {WWW-Authenticate: [Basic realm\security\ charset\UTF-8\,Bearer realm\security\,ApiKey]},reason: missing authentication credentials for REST request [/],type: security_exception}],type: security_exception},status: 401 } 使用 Nodejs echo {type:Bar,id:1,title:Foo} | node -e console.log( JSON.stringify( JSON.parse(require(fs).readFileSync(0) ), 0, 1 )) $ echo {type:Bar,id:1,title:Foo} | node -e console.log( JSON.stringify( JSON.parse(require(fs).readFileSync(0) ), 0, 1 )) {type: Bar,id: 1,title: Foo } 很显然这种方法非常笨拙。你也可以采用如下的方法 echo {foo: lorem, bar: ipsum} | npx json echo {foo: lorem, bar: ipsum} | npx json {foo: lorem,bar: ipsum }使用 json_reformat 在 Linux 机器上安装 yajl-tools 安装包然后使用如下的命令 echo {foo: lorem, bar: ipsum} | json_reformat {foo: lorem,bar: ipsum }
http://www.dnsts.com.cn/news/218963.html

相关文章:

  • 建设门户网站的重要性商务卫士包括网站建设
  • 做充币提现的网站免费商城软件
  • 在线原型设计网站北京百度推广
  • 静态做头像的网站互联网保险平台有哪些
  • 上海企业网站建站手机网站微信咨询
  • 网站怎么申请微信支付接口搜索网站显示网页无法访问
  • 手机网站翻译成中文网站建设空间域名是什么意思
  • 高端品牌网站建设内容江西省住房和城乡建设厅网站首页
  • 搜索网站显示网页无法访问网络服务中心
  • 自己免费做网站(四)河北省质监站网址
  • 免费企业名录网站字体不显示 wordpress
  • 汕头专业网站制作公司wordpress地址如何修改
  • 制作一号店网站怎么做网站策划的模板
  • php网站源代码修改做软装什么网站可以
  • 嘉峪关建设厅官方网站淘宝网站建设分析
  • 建网站策划方案个人养老金保险查询
  • 美食网站策划书范文重庆公司注册需要哪些资料
  • 怎么根据别人的网站做自己的网站模板网建站
  • 百度云域名怎么做网站营销网站开发公司
  • 艺术作品欣赏网站微信怎么开发小程序
  • 网络营销中网站建设的策略做的网站乱码怎么搞
  • 做网站公司 陕西渭南现在网站后台有哪几种模板形式
  • 优秀网站设计赏析怎么写wordpress小程序商城
  • 织梦网站最新漏洞入侵白蛇传奇网页版游戏
  • 重庆神态网站建设网站后台文本编辑器
  • 网站备案很麻烦吗怎么在百度上注册店铺
  • 浙江网站建设前十的公司ui设计课程内容
  • 建网站需什么条件wordpress 360网盘
  • 中国最好网站建设公司排名个人电脑搭建云服务器
  • 网站icp备案信息是什么免费ppt模板大全下载的网站