Dear Group,
I am trying to practice Flask and trying to correspond with it with through
requests.
I am being able to DELETE, GET. But as I am doing POST it is not posting the
data rather returning null.
I tried to search Flask and requests tutorials but did not get much.
I am newly practising Flask, and on Python2.7+ with Windows 7 Professional.
>>> var1=requests.get('http://127.0.0.1:5000/todos')
>>> var2=var2.text
>>> print var3
{
"todo1": {
"task": "build an API"
},
"todo2": {
"task": "How are you?"
},
"todo3": {
"task": "profit!"
}
}
>>> import json
>>> payload = {'key1': 'value1'}
>>> var4=requests.post('http://127.0.0.1:5000/todos', data=json.dumps(payload))
>>> var5=requests.get('http://127.0.0.1:5000/todos')
>>> var6=var5.text
>>> print var6
{
"todo1": {
"task": "build an API"
},
"todo3": {
"task": null
}
}
If anyone may kindly suggest what is the error I am doing.
Regards,
Subhabrata Banerjee.
--
https://mail.python.org/mailman/listinfo/python-list