File: context_manager.py

package info (click to toggle)
python-redfish 3.2.7-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 404 kB
  • sloc: python: 2,883; sh: 17; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 742 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright Notice:
# Copyright 2016-2021 DMTF. All rights reserved.
# License: BSD 3-Clause License. For full text see link:
# https://github.com/DMTF/python-redfish-library/blob/main/LICENSE.md

import sys
import redfish

# When running remotely connect using the address, account name,
# and password to send https requests
login_host = "https://192.168.1.100"
login_account = "admin"
login_password = "password"

## Create a REDFISH object
with redfish.redfish_client(base_url=login_host, username=login_account, password=login_password) as REDFISH_OBJ:
    # Do a GET on a given path
    response = REDFISH_OBJ.get("/redfish/v1/systems/1", None)

    # Print out the response
    sys.stdout.write("%s\n" % response)