CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-httpie

HTTPie: modern, user-friendly command-line HTTP client for the API era.

Pending
Overview
Eval results
Files

cli.mddocs/

Command-Line Interface

HTTPie's command-line interface provides three main commands for making HTTP requests and managing HTTPie functionality.

from httpie.status import ExitStatus
from httpie.cli.constants import *

Capabilities

HTTP Command

The primary http command for making HTTP requests with intuitive syntax.

http [METHOD] URL [REQUEST_ITEM ...]

# METHOD: HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET
# URL: Request URL 
# REQUEST_ITEM: Request items in key=value, key:=json, key@file formats

Request Items:

  • key=value - Form fields or query parameters
  • key:=value - JSON data (value is parsed as JSON)
  • key:=@file - JSON data from file
  • key@file - File upload
  • Header:value - Custom HTTP headers

Usage Examples:

# GET request
http httpie.io/hello

# POST with JSON data
http POST pie.dev/post name=John age:=30 active:=true

# Custom headers
http pie.dev/headers X-Custom-Header:value Authorization:"Bearer token"

# File upload
http --form POST pie.dev/post avatar@~/avatar.jpg

# Query parameters
http pie.dev/get search==httpie limit==10

HTTPS Command

Identical to http but defaults to HTTPS protocol.

https [METHOD] URL [REQUEST_ITEM ...]

HTTPie Management Command

The httpie command provides package and plugin management functionality.

httpie [COMMAND] [OPTIONS]

# Available commands:
# plugins - Plugin management
# sessions - Session management  
# export - Export functionality

Common Options

Output Control

--print=WHAT          # Control output: H (headers), B (body), h (request headers), b (request body)
--headers, -h          # Print only response headers
--body, -b            # Print only response body
--verbose, -v         # Verbose output
--quiet, -q           # Quiet output

Request Configuration

--json, -j            # Serialize data as JSON (default for non-form)
--form, -f            # Serialize data as form (default for form data)
--pretty=FORMAT       # Pretty-print format: all, colors, format, none
--style=STYLE         # Output style (auto, solarized, etc.)
--auth=USER:PASS, -a  # Authentication credentials
--auth-type=TYPE      # Authentication type
--session=NAME        # Session name for persistent data

HTTP Options

--timeout=SECONDS     # Request timeout
--max-redirects=NUM   # Maximum number of redirects
--follow, -F          # Follow redirects
--check-status        # Exit with error status for HTTP error codes
--verify=VERIFY       # SSL certificate verification
--cert=FILE           # SSL client certificate
--proxy=PROTOCOL:URL  # Proxy configuration

Downloads

--download, -d        # Download mode
--continue, -c        # Resume partial download
--output=FILE, -o     # Output file for download

Debugging

--offline             # Build request without sending
--debug               # Debug mode with detailed information
--traceback           # Show full exception traceback

Exit Status Codes

HTTPie returns different exit codes based on the request outcome:

# Success
0    # OK - request completed successfully

# General errors  
1    # Error - general error (network, parsing, etc.)
2    # Timeout - request timed out
6    # Too many redirects

# HTTP status-based errors (when --check-status is used)
3    # HTTP 3xx (redirection) 
4    # HTTP 4xx (client error)
5    # HTTP 5xx (server error)

# Special cases
7    # Plugin error
130  # Keyboard interrupt (Ctrl+C)

Configuration Files

HTTPie reads configuration from:

  • Config file: ~/.config/httpie/config.json (Linux/macOS)
  • Sessions directory: ~/.config/httpie/sessions/
  • Plugins directory: ~/.config/httpie/plugins/

Example config.json:

{
    "default_options": [
        "--style=solarized",
        "--timeout=60"
    ]
}

Request Examples

Authentication

# Basic auth
http -a username:password httpie.io/basic-auth/username/password

# Bearer token
http pie.dev/bearer Authorization:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"

# Custom auth plugin
http --auth-type=ntlm -a domain\\username:password example.com

JSON Requests

# Simple JSON
http POST pie.dev/post name=John age:=30

# Nested JSON
http POST pie.dev/post user[name]=John user[age]:=30

# JSON from file
http POST pie.dev/post @data.json

# Mixed data
http POST pie.dev/post name=John age:=30 token:=@token.txt

File Uploads

# Single file upload
http --form POST pie.dev/post file@document.pdf

# Multiple files
http --form POST pie.dev/post file1@image.jpg file2@document.pdf

# File with metadata
http --form POST pie.dev/post file@image.jpg description="Profile photo"

Sessions

# Create session with login
http --session=user1 -a john:password pie.dev/basic-auth/john/password

# Use session for subsequent requests
http --session=user1 pie.dev/user/profile

# Session persists cookies, auth, and custom headers
http --session=user1 pie.dev/api/data X-Custom-Header:value

Install with Tessl CLI

npx tessl i tessl/pypi-httpie

docs

cli.md

client.md

configuration.md

index.md

models.md

plugins.md

sessions.md

utilities.md

tile.json