Skip to main content

A lightweight Redfish API command-line tool

Project description

🔧 redfishLiteApi

A lightweight command-line tool to interact with Redfish APIs using GET, POST, and PATCH methods. Designed for quick testing, debugging, and field extraction.


📦 Features

  • ✅ Support for GET, POST, and PATCH

  • 🔐 Basic Authentication (-U / -P)

  • 🪪 Redfish Session Token support (--session_token)

  • 🔑 Auto-login to get Redfish session token (--login_session)

  • 📁 JSON body input via file (--json_file)

  • 🔍 Recursive field value search with --find (supports multiple fields)

  • 💾 Save response to file (--save)

  • 🧾 Custom HTTP headers (--header)

  • 🌐 Recursively fetch all linked resources (--all) and save to folder (--file_name)

  • ⏱️ 10-second request timeout to prevent hanging

  • 🧯 Disable SSL verification warnings

  • 📡 HTTP Status display

  • ⚠️ JSON parse error handling with fallback to raw text

  • 🔢 --version support


🚀 Usage

python redfishLiteApi.py --url <API_URL> --method <get|post|patch> [OPTIONS]

🌐 Example: Recursively fetch all resources

python redfishLiteApi.py --url https://<host>/redfish/v1/Systems --method get --all --file_name dump_folder

🪪 Example: Use Redfish session token

python redfishLiteApi.py --url https://<host>/redfish/v1/Systems --method get --session_token <TOKEN>

🔑 Example: Auto-login to get session token

python redfishLiteApi.py --url https://<host>/redfish/v1/Systems --method get --login_session -U admin -P password


🧠 Argument Summary

Argument

Description

--url

Redfish API endpoint URL (required)

--method

HTTP method: get, post, or patch (required)

-U / --username

Basic auth username

-P / --password

Basic auth password

--json_file

Path to JSON file for POST or PATCH body

--find

One or more JSON field names to recursively extract (GET only)

--save

Save the response body to a file

--header

Custom headers in Key:Value format (can be repeated)

--session_token

Use existing Redfish session token for authentication

--login_session

Automatically login and get Redfish session token

--all

Recursively follow @odata.id and save all data into folders

--file_name

Folder name to save files when using --all

--version

Show current version and exit


⚠️ Notes

  • SSL certificate verification is disabled (verify=False).

  • Timeout is hardcoded to 10 seconds.

  • HTTP error handling is basic — be sure to inspect the response if you encounter unexpected results.


🛠 Dependencies

  • Python 3.x

  • requests

Install dependencies via:

pip install -r requirements.txt

requirements.txt content:

requests


📜 License

MIT License

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

redfishliteapi-1.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

redfishliteapi-1.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file redfishliteapi-1.1.0.tar.gz.

File metadata

  • Download URL: redfishliteapi-1.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for redfishliteapi-1.1.0.tar.gz
Algorithm Hash digest
SHA256 830945f48e01c9b582cd627a748b75c41527cfbb6a289e1b87b7b93058caa047
MD5 ff6fea2fa98f8d539c7d6f596c574eab
BLAKE2b-256 9a16939ad369b7984f3476c1b66cda39e67ef0323a4d92e1c0cac720a62428f4

See more details on using hashes here.

File details

Details for the file redfishliteapi-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: redfishliteapi-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for redfishliteapi-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a40409038533ed11da04178ad246b47b25b77accb236064096bd4f46e929727
MD5 9780159329c5cbe6bb721bb26f77e8a3
BLAKE2b-256 bf3a840084e5c8d1a26eff39f0ea979c69591a50d6edab50ac55b118c51d52bb

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