Go to main content

Oracle® ILOM Web Service REST API

Exit Print View

Updated: December 2019
 
 

ilom-rest-basic-auth.py

# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
# simple ILOM rest Client basic auth example for a single request to print the system model / serial number
# tested with Python 2.7, 3.6

import requests
from requests.packages import urllib3

urllib3.disable_warnings(urllib3.exceptions.SubjectAltNameWarning)

response = requests.get('https://<ILOM host or IP>/rest/v1/System',
                        verify='<path to ILOM Certificate',  # set to True if you have a CA signed cert
                        auth=('root', 'changeme'))
response.raise_for_status()
system = response.json()
print (system.get('model'), system.get('serial_number'))