HTTPie 基于 Python 开发网络请求工具
HTTPie is a command-line HTTP client.
如果你经常需要通过终端以非交互模式访问网络服务器(例如,从网络上下载文件,或者是测试 RESTful 网络服务接口),可能你会选择的工具是 wget 或 curl。
HTTPie(读 aych-tee-tee-pie)是一款开源的命令行 HTTP 工具。HTTPie 采用 Python 开发,底层用到了 Requests 和 Pygments 库。HTTPie 设计用来增强 wget 和 curl 的可用性。它的主要目标是使通过命令行与网络服务器进行交互的过程变得尽可能的人性化。其提供了一个简单的 HTTP 环境来让我们通过简单而自然的语法发送任意 HTTP 请求,并显示彩色输出。HTTPie 可用于测试,调试和与 HTTP 服务器进行普通的交互。
Parameters
$ http POST http://example.com/posts/3 \ Origin:example.com \ # : HTTP headers name="John Doe" \ # = string q=="search" \ # == URL parameters (?q=search) age:=29 \ # := for non-strings list:='[1,3,4]' \ # := json file@file.bin \ # @ attach file token=@token.txt \ # =@ read from file (text) user:=@user.json # :=@ read from file (json)
Forms
$ http --form POST example.com \ name="John Smith" \ cv=@document.txt
Mac 上的剪贴板增强 Copyless
一般快捷键我设置成 Ctrl+`,方便左手单手操作,下载地址:https://www.wenjiangs.com/wp-content/uploads/2022/09/9nZ8ulFBFCJUaJDw.zip
HTTPie 直接输入请求体
$ echo 'data' | http example.org $ cat | http POST example.com <paste or typing> ^D
On OS X, you can send the contents of the clipboard with pbpaste:
$ pbpaste | http PUT example.com
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论