Skip to content

bmctools.redfish.fishapi

RedfishAPI

Redfish API client for interacting with the Redfish service.

Parameters:

NameTypeDefaultDescription
ipstr
userstr
passwordstr
verify_sslboolTrue

disable_ssl_verification

def disable_ssl_verification() -> None

Disable SSL certificate verification and suppress InsecureRequestWarning.

Returns: None

get

def get(endpoint: str, params: Optional[dict] = None) -> requests.Response

Send a GET request to a Redfish endpoint.

Args: endpoint: Redfish endpoint path (e.g., ‘/redfish/v1/Systems’). params: Optional query parameters.

Returns: HTTP response object.

Parameters:

NameTypeDefaultDescription
endpointstr
paramsOptional[dict]None

Returns: requests.Response

post

def post(endpoint: str, data: Optional[dict] = None) -> requests.Response

Send a POST request to a Redfish endpoint.

Args: endpoint: Redfish endpoint path. data: Optional request body as a dict (will be JSON-serialized).

Returns: HTTP response object.

Parameters:

NameTypeDefaultDescription
endpointstr
dataOptional[dict]None

Returns: requests.Response

put

def put(endpoint: str, data: Optional[dict] = None) -> requests.Response

Send a PUT request to a Redfish endpoint.

Args: endpoint: Redfish endpoint path. data: Optional request body as a dict (will be JSON-serialized).

Returns: HTTP response object.

Parameters:

NameTypeDefaultDescription
endpointstr
dataOptional[dict]None

Returns: requests.Response

patch

def patch(endpoint: str, data: Optional[dict] = None, headers: Optional[dict] = None) -> requests.Response

Send a PATCH request to a Redfish endpoint.

Args: endpoint: Redfish endpoint path. data: Optional request body as a dict (will be JSON-serialized). headers: Optional additional headers (e.g., {'If-Match': etag}).

Returns: HTTP response object.

Parameters:

NameTypeDefaultDescription
endpointstr
dataOptional[dict]None
headersOptional[dict]None

Returns: requests.Response

delete

def delete(endpoint: str) -> requests.Response

Send a DELETE request to a Redfish endpoint.

Args: endpoint: Redfish endpoint path.

Returns: HTTP response object.

Parameters:

NameTypeDefaultDescription
endpointstr

Returns: requests.Response

post_file

def post_file(endpoint: str, file_path: str, additional_data: Optional[dict] = None, file_field_name: str = 'file') -> requests.Response

Upload a file via multipart form data.

Args: endpoint: The API endpoint file_path: Path to the file to upload additional_data: Optional dict of additional form fields file_field_name: Name of the file field in multipart form (default: ‘file’)

Returns: Response object

Parameters:

NameTypeDefaultDescription
endpointstr
file_pathstr
additional_dataOptional[dict]None
file_field_namestr'file'

Returns: requests.Response

post_multipart

def post_multipart(endpoint: str, file_path: str, update_params: dict, oem_params: Optional[dict] = None) -> requests.Response

Upload firmware using Redfish multipart HTTP push format.

All parts are sent as proper multipart file parts with correct content types.

Args: endpoint: The API endpoint file_path: Path to the firmware file update_params: Dict of update parameters (sent as application/json) oem_params: Optional dict of OEM parameters (sent as application/json)

Returns: Response object

Parameters:

NameTypeDefaultDescription
endpointstr
file_pathstr
update_paramsdict
oem_paramsOptional[dict]None

Returns: requests.Response