Skip to content

FyefoxxM/http-request-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP Request Builder

A simple, fast CLI tool for making HTTP requests. Like curl, but way easier to use.

Why This Exists

Because typing curl commands sucks:

  • Verbose syntax for basic stuff
  • Always forgetting the -H flag placement
  • Can't save common requests
  • JSON responses are unreadable
  • No pretty colors

Installation

# Just need Python 3.6+ and requests
pip install requests --break-system-packages

# Make it executable
chmod +x http_req.py

# Optional: Add to your PATH
sudo ln -s $(pwd)/http_req.py /usr/local/bin/http-req

Usage

Simple GET Request

./http_req.py get https://api.github.com/users/octocat

POST with JSON

./http_req.py post https://api.example.com/users \
  --json '{"name": "Bob", "email": "bob@example.com"}'

POST with Form Data

./http_req.py post https://api.example.com/upload \
  --form "file=@photo.jpg" \
  --form "title=My Photo"

With Authentication

# Bearer token
./http_req.py get https://api.example.com/protected \
  --auth "Bearer your-token-here"

# Basic auth
./http_req.py get https://api.example.com/protected \
  --auth "Basic dXNlcjpwYXNz"

Custom Headers

./http_req.py get https://api.example.com/data \
  --header "Content-Type: application/json" \
  --header "X-Custom-Header: value"

Other Methods

# PUT
./http_req.py put https://api.example.com/users/123 \
  --json '{"name": "Updated Name"}'

# DELETE
./http_req.py delete https://api.example.com/users/123

Save Common Requests

# Save a request
./http_req.py save my-api get https://api.example.com/data \
  --auth "Bearer token123"

# Run saved request
./http_req.py run my-api

# List all saved requests
./http_req.py list

Hide Curl Command

./http_req.py get https://api.example.com/data --no-curl

Features

  • ✅ Supports GET, POST, PUT, DELETE
  • ✅ Color-coded status codes (green=success, red=error)
  • ✅ Auto-formats JSON responses
  • ✅ Shows equivalent curl command
  • ✅ Save and reuse common requests
  • ✅ Bearer token and custom header support
  • ✅ Form data and JSON payloads
  • ✅ Under 300 lines of Python

What It Doesn't Do (v1)

  • OAuth flows - too complex for v1
  • File uploads - beyond simple form data
  • Request history - might add in v2
  • GraphQL - different beast entirely
  • Certificate verification options - requests handles it

Output Example

Equivalent curl command:
curl -X GET 'https://api.github.com/users/octocat'

Status: 200
Headers:
  Content-Type: application/json
  X-RateLimit-Remaining: 59

Response Body:
{
  "login": "octocat",
  "id": 1,
  "name": "The Octocat",
  "company": "@github"
}

Dependencies

  • Python 3.6+
  • requests library

That's it. No bloat.

Why Not Just Use Curl?

You should! This is for when you:

  • Forget curl syntax constantly
  • Want pretty JSON without piping to jq
  • Need to save common API calls
  • Want colors in your terminal
  • Value speed over power

Why Not Just Use Postman?

Postman is great! But:

  • This lives in your terminal
  • No GUI, no account needed
  • Instant startup
  • Can be scripted
  • Under 300 lines vs. a 200MB Electron app

License

MIT - Do whatever you want with it

Stats

  • Lines of code: ~280
  • Time to build: ~6 hours
  • Dependencies: 1 (requests)
  • Coffee consumed: 3 cups

Releases

No releases published

Packages

No packages published