标签:终端 post bottom 方法 parameter distrib body too let
HTTPie 是用 Python 编写,用到了 Requests 和 Pygments 这些出色的库。
主要特性:
Mac
OS X
$ brew install httpie
Linux
# Debian-based distributions such as Ubuntu: $ apt-get install httpie # RPM-based distributions: $ yum install httpie
通过pip:
# Make sure we have an up-to-date version of pip and setuptools: $ pip install --upgrade pip setuptools $ pip install --upgrade httpie
使用
hello world
$ http httpie.org
http --help
參考手冊
https://pypi.python.org/pypi/httpie
$ http PUT example.org X-API-Token:123 name=John
$ http -f POST example.org hello=World
$ http -v example.org
$ http -a USERNAME POST https://api.github.com/repos/jakubroztocil/httpie/issues/83/comments body=‘HTTPie is awesome!‘
$ http example.org < file.json
$ http example.org/file > file
$ http --download example.org/file
$ http --session=logged-in -a username:password httpbin.org/get API-Key:123 $ http --session=logged-in httpbin.org/headers
$ http localhost:8000 Host:example.com
HTTP 请求方法位于 URL的左边,以下是使用DELETE方法进行请求
$ http DELETE example.org/todos/7
就像运行了以下的request-line命令行
DELETE /todos/7 HTTP/1.1
HTTPie 默认使用 GET (with no request data) 或者 POST (with request data).
HTTPie 须要请求一个URL. 默认的 scheme 是 http://, 并且能够省略參数 – http , example.org就代表了 http://example.org,此外,支持curl类似的localhost, 比如 :3000 代表 http://localhost:3000, 默认是80port
$ http :/foo
GET /foo HTTP/1.1 Host: localhost
$ http :3000/bar
GET /bar HTTP/1.1 Host: localhost:3000
$ http :
GET / HTTP/1.1 Host: localhost
当手动在url中加入 querystring parameters , 能够直接使用 key==value key==value 的形式而不用操心 & 符号.
$ http GET www.google.com search==HTTPie tbm==isch
GET /?search=HTTPie&tbm=isch HTTP/1.1
HTTPie: a CLI, cURL-like tool for humans
标签:终端 post bottom 方法 parameter distrib body too let
原文地址:http://www.cnblogs.com/wzzkaifa/p/6918614.html