Right now I am programming an API with python, and I have the following problem: I have to POST the following JSON to an url:
prescription = {
"Name": “file_name", # This is a string
"Body" : "xxx",# (File in base64 format)
"ParentId" : "xxxxxxxxxxxxxxxxxx", # This is a string
"ContentType" : "xxxxx/xxx" # This is a string
}
But when I try to do the following request:
requests.post(url, prescription)
I am getting the following error:
TypeError: Object of type bytes is not JSON serializable
How can I make a request for posting that JSON? Is it even possible?
Thanks for your help.
EDIT: Using
"Body" : "xxx.decode("utf-8")"
worked, thanks for the help