Registry / http-networking / httpie

httpie

JSON →
library3.2.4pypypi✓ verified 22d ago

HTTPie is a modern, user-friendly command-line HTTP client for the API era, designed to make API interaction intuitive and efficient. The current version is 3.2.4, and it maintains an active release cadence with frequent patch and minor updates.

pip install httpie
INSTALL
IMPORT
SIG · HTTPIE
H
httpie
http-networkingpythonv3.2.4
Install
4.2s avg
Import
Disk
38MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.2.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 36.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.2s · import 0.000s · 37MB
38MB installed
● package 38MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

main
from httpie import main
from httpie import call_main

This quickstart demonstrates both the recommended way of using HTTPie programmatically (as a subprocess) and the experimental direct `call_main` API. The subprocess method provides stability and mimics standard CLI usage. Remember to set `HTTP_AUTH_TOKEN` in your environment for the auth example.

import subprocess from httpie.core import call_main # Recommended: Run HTTPie as a subprocess print("--- Using subprocess (recommended) ---") try: result = subprocess.run(['http', 'https://httpbin.org/get', 'X-Auth-Token: ' + os.environ.get('HTTP_AUTH_TOKEN', 'none')], capture_output=True, text=True, check=True) print(result.stdout) except subprocess.CalledProcessError as e: print(f"Subprocess failed: {e}\n{e.stderr}") # Alternative: Use the internal call_main (API not guaranteed stable) print("\n--- Using httpie.core.call_main (experimental) ---") # Redirect stdout/stderr to capture output, as call_main prints directly import io import sys old_stdout = sys.stdout redirected_output = io.StringIO() sys.stdout = redirected_output try: # call_main expects a list of CLI arguments args = ['https://httpbin.org/post', 'hello=world', 'Content-Type: application/json'] status_code = call_main(args) print(f"Call main exited with status: {status_code}") print(redirected_output.getvalue()) finally: sys.stdout = old_stdout # Restore stdout # Example of setting an environment variable for a subprocess call import os os.environ['HTTP_TEST_VAR'] = 'test_value' print("\n--- Subprocess with environment variable ---") try: result_env = subprocess.run(['http', 'https://httpbin.org/get', 'HTTP_TEST_VAR'], capture_output=True, text=True, check=True) print(result_env.stdout) except subprocess.CalledProcessError as e: print(f"Subprocess failed: {e}\n{e.stderr}") del os.environ['HTTP_TEST_VAR'] # Clean up
http --version
Debug
Known issues
breakingHTTPie v3.0.0 and later dropped support for Python 3.6. Users on older Python versions must upgrade Python or stick to HTTPie versions < 3.0.0.
fix
Upgrade Python to 3.7 or newer, or pin `httpie<3.0.0`.
affects: >=3.0.0
gotchaThe `httpie.core` programmatic API (e.g., `call_main`) is not officially stable and is subject to change between versions without a dedicated deprecation cycle. Direct programmatic interaction should be used with caution.
fix
For stable programmatic integration, it is generally recommended to run HTTPie as a subprocess, parsing its standard output and error streams. This mirrors how the CLI is intended to be used.
affects: All
gotchaHTTPie has experienced issues with SSL connections and compatibility with underlying `requests` and `urllib3` versions in the past (e.g., 3.2.2, 3.2.3, 3.2.4 patches). While often resolved quickly, this indicates sensitivity to its core dependencies.
fix
Ensure you are running the latest patch release of HTTPie to benefit from the most recent dependency compatibility fixes. If encountering SSL issues, check the HTTPie GitHub releases for recent fixes.
affects: 3.2.2, 3.2.3, 3.2.4 (fixed in these respective versions)
deprecatedHTTPie v3.1.0 fixed a critical security vulnerability related to cookie exposure on redirects to third-party hosts. While fixed, relying on older versions could expose users to this vulnerability.
fix
Upgrade to HTTPie v3.1.0 or newer immediately to mitigate the cookie exposure vulnerability. Regularly update HTTPie to receive security patches.
affects: <3.1.0
Upgrade
Version history
3.2.4latest on PyPI · released Nov 1, 2024
Audit
Dependencies
requestsrequiredCore HTTP client functionality, subject to version-specific fixes in HTTPie releases.
urllib3requiredUnderlying HTTP connection pool management, also subject to compatibility fixes.
Agent activity
15 hits · last 30 days
node
14
Resources
httpie — pip install httpie · libregistry