Reference Guide

42 RESTful Server Configuration with iDRAC RESTful API
3 Tips, tricks, and suggestions
1. Depending on the execution environment, Python scripts may generate warnings that do not affect
execution. The following example shows warning messages that may occur while running a Python script
although the script returns the correct status code and job ID:
$ rest_SCP_export_script.py
C:\Python26\lib\site-packages\requests-2.10.0-
py2.6.egg\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An
HTTPS request has been made, but the SNI (Subject Name Indication) extension to
TLS is not available on this platform. This may cause the server to present an
incorrect TLS certificate, which can cause validation failures. You can upgrade
to a newer version of Python to solve this. For more information, see
https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
C:\Python26\lib\site-packages\requests-2.10.0-
py2.6.egg\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A
true SSLContext object is not available. This prevents urllib3 from configuring
SSL appropriately and may cause certain SSL connections to fail. You can upgrade
to a newer version of Python to solve this. For more information, see
https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
C:\Python26\lib\site-packages\requests-2.10.0-
py2.6.egg\requests\packages\urllib3\connectionpool.py:821:
InsecureRequestWarning: Unverified HTTPS request is being made. Adding
certificate verification is strongly advised. See:
https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning)
202
JID_744059638886
$
2. When the RESTful API calls return a failure or do not return a Job ID, extra details are available from a
built-in message dictionary located with the “@Message.ExtendedInfo” key. The following example
illustrates the Python script and shows execution of the script to return an error message string. To
generate an error, we pass in an unsupported ShareType of “FTP”.
Example Python script which looks for a specific status code and then parses the data, and prints the
error message in pretty format.
import requests, json, re, sys
url = 'https://192.168.0.120/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem
/EID_674_Manager.ExportSystemConfiguration'
payload = {"ExportFormat":"XML","ShareParameters":{"Target":"ALL","IPAddress"
:"192.168.0.130","ShareName":"cifs_share","ShareType":"FTP","FileName":"R730_
SCP.xml","UserName":"user","Password":"password"}}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers, veri
fy=False, auth=('username','password'))
print '\n- Response status code is: %s' % response.status_code