6. nidhogg helpers

nidhogg.http module

class nidhogg.http.NidhoggHttp(url, username, password)

Bases: object

Requests the Netapp API und converts the response into a dictionary.

invoke_request(req)

Request the Netapp API.

Parameters:req (dict) – dictionary of request params
Returns:Netapp API response
Return type:str
parse_xml_reply(xmlresponse)

Convert XML reply into a dictionary.

Parameters:xmlresponse (str) – Response from Netapp API.
Returns:response
Return type:dict

nidhogg.utils module

nidhogg.utils.safe_get(d, key)

Helper function.

Parameters:
  • d (dict) – dictionary
  • key (str) – key to retrieve from dict
Returns:

value of specified key if not None, otherwise empty dict

nidhogg.utils.underline_to_dash(d)

Helper function to replace “_” to “-” in keys of specifed dictionary recursively.

Netapp API uses “-” in XML parameters.

Parameters:d (dict) – dictionary of dictionaries or lists
Returns:new dictionary
Return type:dict