An interactive HTTP command-line client
Project description
HTTP Prompt is an interactive command-line HTTP client featuring autocomplete and syntax highlighting, built on HTTPie and prompt_toolkit.
Installation
Just install it like a regular Python package:
$ pip install http-prompt
You’ll probably see some permission errors if you’re trying to install it on the system-wide Python. It isn’t recommended. But if that’s what you want to do, you need to sudo:
$ sudo pip install http-prompt
Another alternative is to use --user option to install the package into your user directory:
$ pip install --user http-prompt
To upgrade HTTP Prompt, do:
$ pip install -U http-prompt
Quickstart
To start a session, you use the http-prompt executable:
# Start with the given URL
$ http-prompt http://httpbin.org
# Or start with some initial options
$ http-prompt localhost:8000/api --auth user:pass username=somebody
Once you’re in a session, you can use the following commands.
To change URL address, use cd:
# Relative URL path
> cd api/v1
# Absolute URL
> cd http://localhost/api
To add headers, querystring, or body parameters, use the syntax as in HTTPie. The following are all valid:
> Content-Type:application/json username=john
> 'name=John Doe' apikey==abc
> Authorization:"Bearer auth_token"
You can also add HTTPie options like this:
> --form --auth user:pass
> --verify=no username=jane
To preview how HTTP Prompt is going to call HTTPie, do:
> httpie post
http --auth user:pass --form POST http://localhost/api apikey==abc username=john
You can temporarily override the request parameters by supplying options and parameters in httpie command. The overrides won’t affact the later requests.
# No parameters initially
> httpie
http http://localhost
# Override parameters temporarily
> httpie /api/something page==2 --json
http --json http://localhost/api/something page==2
# Current state is not affected by the above overrides
> httpie
http http://localhost
To actually send a request, enter one of the HTTP methods:
> get
> post
> put
> patch
> delete
> head
The above HTTP methods also support temporary overriding:
# No parameters initially
> httpie
http http://localhost
# Send a request with some overrided parameters
> post /api/v1 --form name=jane
# Current state remains intact
> httpie
http http://localhost
To remove an existing header, a querystring parameter, a body parameter, or an HTTPie option:
> rm -h Content-Type
> rm -q apikey
> rm -b username
> rm -o --auth
To reset the session, i.e., clear all parameters and options:
> rm *
To exit a session, simply enter:
> exit
Note that all the options are gone once you exit.
Roadmap
User configuration file, i.e., an RC file
More HTTP headers for autocomplete
More tests, e.g., integration test and testing on Windows
More documentation
Support for advanced HTTPie syntax, e.g, field:=json and field=@file.json
Support for cURL command preview
Shell command evaluation
Python syntax evaluation
HTTP/2 support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for http_prompt-0.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 560f3080d7aebd387c838016abd596c5e63441b5e8802dbed798972b0b20dc9b |
|
MD5 | 32e96e053a9e1cbb705e144e77921954 |
|
BLAKE2b-256 | b36c79dd527a2ded745413c6b372bd6afe3d8ba471cf8375af53deb889a36c49 |