Skip to main content

ReqNinja - A Python package and CLI tool for API testing, automation, and debugging

Project description

ReqNinja

PyPI version Python Support License: MIT Tests Coverage

ReqNinja is a Python package and CLI tool for API testing, automation, and debugging — blending the simplicity of curl with the power and flexibility of Python's requests.

🚀 Features

  • Retries & Backoff: Automatic retry logic for flaky APIs with customizable policies
  • Fast Timing: Instantly see how long each request takes
  • Pretty Output: Syntax-highlighted JSON straight in your terminal
  • Authentication: Bearer tokens, Basic Auth, OAuth2, and API keys via config
  • Config Profiles: Quickly switch environments or base URLs
  • Response Saving: Export results to .json or .txt files
  • Multiple Output Modes: Raw, pretty JSON, tabular view, show headers
  • Powerful CLI: Run API calls with a simple command, no Python required
  • Debug Mode: Print full request/response details with timing breakdowns
  • Productivity Boost: Pipe support, save/run commands, batch mode
  • Extensible: Plugin system for custom output or request logic

📦 Installation

From PyPI (recommended)

pip install reqninja

From Source

git clone https://github.com/vishal-ravi/reqninja.git
cd reqninja
pip install -e .

Development Installation

git clone https://github.com/vishal-ravi/reqninja.git
cd reqninja
python setup_dev.py

🖥️ Quickstart: CLI Mode

GET Request with Pretty Output

reqninja http GET https://jsonplaceholder.typicode.com/posts/1

POST JSON with Custom Headers

reqninja http POST https://httpbin.org/post \
  -d '{"name":"Vishal"}' \
  -H "Content-Type: application/json"

Show Raw Output

reqninja http GET /data --raw

Save Response

reqninja http GET /users --save results.json

Switch Profile

reqninja http GET /users --profile prod

View Timing and Debug Info

reqninja http GET /users --debug

💻 Quickstart: Python Library

from reqninja import get, post

response = get("https://jsonplaceholder.typicode.com/posts/1", retries=3)
print(response.json())  # Pretty printed automatically

🛠 Config Example (~/.reqninja/config.yml)

default_retries: 3
default_headers:
  Content-Type: application/json
profiles:
  prod:
    base_url: https://api.myapp.com
    headers:
      Authorization: Bearer ${TOKEN}
  staging:
    base_url: https://staging.api.myapp.com
retry_policy:
  total: 5
  status_forcelist: [429, 500, 502, 503, 504]
  backoff_factor: 0.5

🔒 Authentication Made Simple

Pass tokens and credentials via CLI:

  • --auth bearer <TOKEN>
  • --auth basic user:pass

Or set them in your config file under the desired profile.

🏆 Productivity Shortcuts

  • Pipe: cat payload.json | reqninja http POST https://api.com/data
  • Save a Command: reqninja save getUser "GET /users/1"
  • Run Saved Command: reqninja run getUser
  • Batch Mode: Send a list of API calls from a file

🐞 Debugging

reqninja http POST /login --debug

Prints the full request, headers, body, and a timing breakdown for deeper inspection.

📝 Roadmap

  • 🔑 Plugin system for custom output/auth logic
  • 🎨 Templated payloads for batch/bulk requests
  • 💡 Open response in browser (--open)
  • 📁 Advanced response export filters

🙌 Why Use ReqNinja?

A single, modern tool for both quick API experiments and robust automation — with the polish, safety, and visibility pro devs expect.

📚 Documentation

For complete documentation, visit reqninja.readthedocs.io

🤝 Contributing

Contributions are welcome! Please see our Contributing Guide for details.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reqninja-1.0.0.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reqninja-1.0.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file reqninja-1.0.0.tar.gz.

File metadata

  • Download URL: reqninja-1.0.0.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for reqninja-1.0.0.tar.gz
Algorithm Hash digest
SHA256 074d3bf8c9878d1573e0baaeba07593807f667c8c259e203f172d74184261854
MD5 aea2805e2231bb33c81f18b163cee66b
BLAKE2b-256 f042634b39320a2de6ef356d75f4ea92d5e7593299588fa96c8ffa85bbd9a0d0

See more details on using hashes here.

File details

Details for the file reqninja-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: reqninja-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for reqninja-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02781a21f81ea30e80fb9a75c209b2df730e50d0c7cd80f1abb225c504fa5da7
MD5 3a57ca856e8a0704da482f57c6465d59
BLAKE2b-256 fb4e866c74d4d0b8f7844b1652ae79d3fbf41f403b4cd3273b93628b9f4926cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page