import requests


def _request_ucs_fi_device_connector_device_id(
    ucs_fi_device_console_ip,
    ucs_fi_device_console_login
    ):
    """"This is a function to request an HTTP response for the Device ID
    of a UCS Fabric Interconnect under Intersight Managed Mode (IMM).

    Args:
        ucs_fi_device_console_ip (str):
            The IP address of a UCS Fabric Interconnect under Intersight
            Managed Mode (IMM).
        ucs_fi_device_console_login (Response):
            A Response class instance of a UCS Fabric Interconnect Device
            Console login HTTP request.

    Returns:
        A Response class instance for the UCS Fabric Interconnect Device ID
        HTTP request.

    Raises:
        Exception:
            An exception occurred due to an issue with the UCS Fabric
            Interconnect Device ID HTTP request.
    """
    # Obtain Device ID
    ucs_fi_device_connector_headers = {
        "Accept-Language": "application/json"
        }
    ucs_fi_device_connector_device_id_url = f"https://{ucs_fi_device_console_ip}/connector/DeviceIdentifiers"
    try:
        ucs_fi_device_connector_device_id_request = requests.get(
            ucs_fi_device_connector_device_id_url,
            cookies=ucs_fi_device_console_login.cookies,
            headers=ucs_fi_device_connector_headers,
            verify=False
            ) 
        return ucs_fi_device_connector_device_id_request
    except Exception as exception_message:
        print("\nA configuration error has occurred!\n")
        print("Unable to obtain the Device ID for the Device Connector "
              f"of {ucs_fi_device_console_ip}.\n")
        print("Exception Message: ")
        print(exception_message)