All     Ethical Hacking     Networking     Programming     OSINT

httpx in Termux – Installation, Usage & Basic Commands (Python CLI)

httpx is a Python-based HTTP client that can be used from the command line to send HTTP requests. It is useful for testing APIs, checking responses, and debugging HTTP requests. This version is installed using pip and requires a full URL with protocol.

Installation

Update Termux and install Python:

pkg update && pkg upgrade -y && pkg install python -y

Install httpx CLI using pip:

pip install "httpx[cli]"

Verify installation:

httpx --help

Usage Commands

Send a GET request to a website (protocol required):

httpx https://google.com

Send a GET request using HTTP:

httpx http://example.com

Show response headers:

httpx https://example.com --headers

Send a POST request:

httpx post https://example.com/api

Send JSON data with POST request:

httpx post https://example.com/api -j '{"name":"test"}'

Set a custom User-Agent:

httpx https://example.com -H "User-Agent: Termux"

Save response output to a file:

httpx https://example.com > response.txt