mirror of
https://github.com/httpie/cli.git
synced 2024-11-24 08:22:22 +02:00
Renamed the CLI tool http
.
This commit is contained in:
parent
459c9f1a33
commit
258fc0cd5f
54
README.md
54
README.md
@ -1,6 +1,6 @@
|
||||
## HTTPie: cURL for humans
|
||||
|
||||
HTTPie is a CLI frontend for [python-requests](http://python-requests.org).
|
||||
HTTPie is a CLI frontend for [python-requests](http://python-requests.org) build out of frustration from using `curl`. It provides an `http` command that can be used to easily issue HTTP requests. It is meant to be used by humans to interact with HTTP-based APIs and web servers. The response headers are colorized and the body is syntax-highlighed if its `Content-Type` is known to [Pygments](http://pygments.org/) (unless the output is redirected).
|
||||
|
||||
![httpie](https://github.com/jkbr/httpie/raw/master/httpie.png)
|
||||
|
||||
@ -12,11 +12,11 @@ HTTPie is a CLI frontend for [python-requests](http://python-requests.org).
|
||||
|
||||
### Usage
|
||||
|
||||
httpie [flags] METHOD URL [header:value | data-field-name=value]*
|
||||
http [flags] METHOD URL [header:value | data-field-name=value]*
|
||||
|
||||
The default request `Content-Type` is `application/json` and data fields are automatically serialized as a JSON `Object`, so this:
|
||||
|
||||
httpie PATCH api.example.com/person/1 X-API-Token:123 name=John
|
||||
http PATCH api.example.com/person/1 X-API-Token:123 name=John email=john@example.org
|
||||
|
||||
Will issue the following request:
|
||||
|
||||
@ -25,13 +25,53 @@ Will issue the following request:
|
||||
X-API-Token: 123
|
||||
Content-Type: application/json; charset=utf-8
|
||||
|
||||
{"name": "John"}
|
||||
|
||||
{"name": "John", "email": "john@example.org"}
|
||||
|
||||
You can use the `--form` flag to set `Content-Type` and serialize the data as `application/x-www-form-urlencoded`.
|
||||
|
||||
The data to be sent can also be passed via `stdin`:
|
||||
|
||||
httpie PUT api.example.com/person/1 X-API-Token:123 < person.json
|
||||
http PUT api.example.com/person/1 X-API-Token:123 < person.json
|
||||
|
||||
Most of the flags mirror the arguments you would use with `requests.request`. See `httpie -h` for more details.
|
||||
Most of the flags mirror the arguments you would use with `requests.request`. See `http -h`:
|
||||
|
||||
$ http -h
|
||||
usage: http [-h] [--json | --form] [--traceback] [--ugly] [--headers | --body]
|
||||
[--auth AUTH] [--verify VERIFY] [--proxy PROXY]
|
||||
[--allow-redirects] [--file PATH] [--timeout TIMEOUT]
|
||||
method URL [item [item ...]]
|
||||
|
||||
HTTPie - cURL for humans.
|
||||
|
||||
positional arguments:
|
||||
method HTTP method to be used for the request (GET, POST,
|
||||
PUT, DELETE, PATCH, ...).
|
||||
URL Protocol defaults to http:// if the URL does not
|
||||
include it.
|
||||
item HTTP header (key:value) or data field (key=value)
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--json, -j Serialize data items as a JSON object and set Content-
|
||||
Type to application/json, if not specified.
|
||||
--form, -f Serialize data items as form values and set Content-
|
||||
Type to application/x-www-form-urlencoded, if not
|
||||
specified.
|
||||
--traceback Print a full exception traceback should one be raised
|
||||
by `requests`.
|
||||
--ugly, -u Do not prettify the response.
|
||||
--headers, -t Print only the response headers.
|
||||
--body, -b Print only the response body.
|
||||
--auth AUTH, -a AUTH username:password
|
||||
--verify VERIFY Set to "yes" to check the host's SSL certificate. You
|
||||
can also pass the path to a CA_BUNDLE file for private
|
||||
certs. You can also set the REQUESTS_CA_BUNDLE
|
||||
environment variable.
|
||||
--proxy PROXY String mapping protocol to the URL of the proxy (e.g.
|
||||
http:foo.bar:3128).
|
||||
--allow-redirects Set this flag if full redirects are allowed (e.g. re-
|
||||
POST-ing of data at new ``Location``)
|
||||
--file PATH File to multipart upload
|
||||
--timeout TIMEOUT Float describes the timeout of the request (Use
|
||||
socket.setdefaulttimeout() as fallback).
|
||||
|
||||
|
BIN
httpie.png
BIN
httpie.png
Binary file not shown.
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 61 KiB |
@ -14,7 +14,7 @@ from . import pretty
|
||||
|
||||
|
||||
__author__ = 'Jakub Roztocil'
|
||||
__version__ = '0.1.2'
|
||||
__version__ = '0.1.3'
|
||||
__licence__ = 'BSD'
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ group_only.add_argument('--body', '-b', dest='print_headers',
|
||||
|
||||
|
||||
# ``requests.request`` keyword arguments.
|
||||
parser.add_argument('--auth', help='username:password',
|
||||
parser.add_argument('--auth', '-a', help='username:password',
|
||||
type=KeyValueType(SEP_COMMON))
|
||||
parser.add_argument('--verify',
|
||||
help='Set to "yes" to check the host\'s SSL certificate.'
|
||||
|
2
setup.py
2
setup.py
@ -8,5 +8,5 @@ setup(name='httpie',version=httpie.__version__,
|
||||
author=httpie.__author__,
|
||||
license=httpie.__licence__,
|
||||
packages=['httpie'],
|
||||
entry_points={'console_scripts': ['httpie = httpie.httpie:main']},
|
||||
entry_points={'console_scripts': ['http = httpie.httpie:main']},
|
||||
install_requires=['requests>=0.10.4', 'Pygments>=1.4'])
|
||||
|
Loading…
Reference in New Issue
Block a user