LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

httpx2

Command-line HTTP client from the HTTPX2 Python library

TLDR

GET a URL and print a highlighted response body
$ httpx2 [https://example.com]
copy
POST JSON (method becomes POST when a body is given)
$ httpx2 [https://api.example.com/items] -j ['{"name":"ada"}']
copy
Send form fields
$ httpx2 [https://example.com/login] -d [username] [ada] -d [password] [s3cret]
copy
Add a header (name and value are two arguments)
$ httpx2 [https://api.example.com] -h [Authorization] [Bearer token]
copy
Follow redirects and show the request as well as the response
$ httpx2 [https://example.com] --follow-redirects -v
copy
Download the body to a file
$ httpx2 [https://example.com/file.bin] --download [file.bin]
copy
Use HTTP/2 if the server supports it (needs the http2 extra)
$ httpx2 [https://example.com] --http2
copy

SYNOPSIS

httpx2 URL [options]

DESCRIPTION

httpx2 is the optional command-line client shipped with HTTPX2, Pydantic's maintained continuation of the Python httpx library. It is not ProjectDiscovery's httpx probe toolkit (documented as httpx in this library).Install the CLI extra, which pulls in click, rich, and pygments:

$ pip install 'httpx2[cli]'
copy
That registers the console script httpx2. Without [cli], the Python package still installs but the command is not available.The tool sends one HTTP request and prints a syntax-highlighted body (JSON pretty-printed when the content type is JSON). Binary responses print a byte-count placeholder. Exit status is 0 on a successful HTTP status, 1 on a 4xx/5xx response or a transport error.HTTPX2 verifies TLS against the operating-system trust store (via truststore), not the certifi bundle used by classic httpx. In minimal containers, install CA certificates in the OS store or set SSL_CERT_FILE / SSL_CERT_DIR.The same package is a full sync/async Python HTTP client (`import httpx2`). The CLI is a thin wrapper around httpx2.Client.

PARAMETERS

-m METHOD, --method METHOD

HTTP method: GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD, QUERY. Default GET, or POST if a request body is included.
-p NAME VALUE, --params NAME VALUE
Query parameter. Repeatable.
-c TEXT, --content TEXT
Raw request body.
-d NAME VALUE, --data NAME VALUE
Form field in the request body. Repeatable.
-f NAME FILE, --files NAME FILE
Multipart file field. Repeatable.
-j TEXT, --json TEXT
JSON request body (must be valid JSON).
-h NAME VALUE, --headers NAME VALUE
Extra request header. Repeatable.
--cookies NAME VALUE
Cookie. Repeatable.
--auth USER PASS
HTTP basic auth. Use - as the password to prompt. --verbose prints the Authorization header (reversible encoding).
--proxy URL
Proxy URL for the request.
--timeout FLOAT
Network timeout in seconds (default 5.0).
--follow-redirects
Follow HTTP redirects.
--no-verify
Disable TLS certificate verification.
--http2
Prefer HTTP/2 when the server supports it. Requires pip install 'httpx2[http2]'.
--download FILE
Write the response body to FILE instead of printing it.
-v, --verbose
Print the request (and TLS details) as well as the response.
--help
Show help and exit.

INSTALL

brew install httpx2
copy

CAVEATS

The binary name httpx2 does not collide with ProjectDiscovery httpx, but mixing the two in scripts is easy if you type the wrong command.--http2 needs the optional h2 extra. SOCKS proxies and Brotli/Zstd decoding are also optional extras (httpx2[socks], httpx2[brotli], httpx2[zstd]), not CLI flags.Requires Python 3.10+. Pair options (--headers, --params, --data, --auth, --cookies, --files) take two argv tokens, not Name:Value as in HTTPie.

HISTORY

HTTPX was created by Tom Christie (encode/httpx). With upstream activity slowing, Pydantic forked stewardship as HTTPX2 (BSD-3-Clause) so the library keeps receiving security and maintenance updates. The CLI command was renamed from httpx to httpx2 to match the package.

SEE ALSO

curl(1), http(1), httpie(1), xh(1), wget(1), python(1)

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid