httpie-cli/README.md

38 lines
1.0 KiB
Markdown
Raw Normal View History

2012-02-25 13:39:38 +01:00
## HTTPie: cURL for humans
2012-02-25 13:52:29 +01:00
HTTPie is a CLI frontend for [python-requests](http://python-requests.org).
2012-02-25 13:39:38 +01:00
2012-02-25 14:42:06 +01:00
![httpie](https://github.com/jkbr/httpie/raw/master/httpie.png)
2012-02-25 13:39:38 +01:00
### Installation
pip install httpie
2012-02-25 13:47:23 +01:00
### Usage
2012-02-25 13:39:38 +01:00
2012-02-25 16:58:39 +01:00
httpie [flags] METHOD URL [header:value | data-field-name=value]*
2012-02-25 13:47:23 +01:00
2012-02-25 13:49:50 +01:00
The default request `Content-Type` in `application/json` and data fields are automatically serialized as a JSON `Object`, so this:
2012-02-25 13:47:23 +01:00
2012-02-25 16:59:37 +01:00
httpie PATCH api.example.com/person/1 X-API-Token:123 name=John
2012-02-25 13:47:23 +01:00
2012-02-25 13:49:50 +01:00
Will issue the following request:
2012-02-25 13:47:23 +01:00
PATCH /person/1 HTTP/1.1
User-Agent: HTTPie/0.1
X-API-Token: 123
Content-Type: application/json; charset=utf-8
{"name": "John"}
2012-02-25 13:49:50 +01:00
You can use the `--form` flag to set `Content-Type` and serialize the data as `application/x-www-form-urlencoded`.
2012-02-25 13:39:38 +01:00
2012-02-25 13:47:23 +01:00
The data to be sent can also be passed via `stdin`:
2012-02-25 16:58:39 +01:00
httpie PUT api.example.com/person/1 X-API-Token:123 < person.json
2012-02-25 13:47:23 +01:00
2012-02-25 13:49:50 +01:00
Most of the flags mirror the arguments you would use with `requests.request`. See `httpie -h` for more details.
2012-02-25 13:47:23 +01:00