I want to call POST from micropython to Django webserver. The POST payload shows up as empty when called from the micropython code. When the same code is ran with C-Python, it does show up with the filled payload.
Here is the micropython code -
import urequests as requests
url = "http://192.168.0.33:8000/species/"
payload={'name': 'test12',
'classification': 'sheep12',
'language': 'sheep_lang12'}
files=[
]
headers = { 'Content-Type': 'application/x-www-form-urlencoded'}
response = requests.request("POST", url, headers=headers, data=payload)
print('success')
print(response.text)
The output of response.txt is - {'name':'',classification:'',language:''}
I also tried using an alternative of the payload to use JSON. Here is the JSON payload attempt
import urequests as requests
import ujson as json
url = "http://192.168.0.33:8000/species/"
payload={'name': 'test12',
'classification': 'sheep12',
'language': 'sheep_lang12'}
files=[
]
headers = { 'Content-Type': 'application/x-www-form-urlencoded'}
response = requests.request("POST", url, headers=headers, data=json.dumps(payload))
print('success')
print(response.text)
What did I miss here ?