I am working with Python. Currently creating an API to get information from Mender.
I want to send a post request. In my body one of the parameter got '\n' symbol. I WANT it to stay that way otherwise my request won't work. This is a new line symbol I do not want it to be escaped as a character.
Here is my code. If I print my argument before creating the 'data' object it prints '\n' as expected. BUT if I print my 'data' object all my '\n' had been transformed into '\\n' so when I dump my 'data' object my '\n' are now '\\\\n'.
data = {
"identity_data": {
"mac": args.mac_address,
"sku": args.sku
},
"pubkey": args.public_key,
"tenant_token": args.tenant_token
}
print(data)
data = json.dumps(data).encode("utf-8")
api.deviceauth.create(headers=headers, data=data)
Please is there a way to avoid this default behavior of Python ? how Am I supposed to send new line symbol in a post request ? Thank you all