DMTF/python-redfish-library

Unable to post body with boolen data

Opened this issue · 3 comments

body = {"Enabled": true}
foo = redfish_client.patch('/redfish/v1/AccountService/Accounts/3', body=body)

Python will throw "NameError: name 'true' is not defined" error

How to set the body data in this case?

When you set up the body like that, you're creating a python dictionary. It doesn't get converted to a JSON string until a call is made into the patch routine.

So, you need to set the body like this:

body = {"Enabled": True}
4383 commented

@jixiang1912 is it ok for you?
Do you need more help?

6/20: Closing; problem with the Python syntanx in the submitter's code. Answer given for how to fix it.