2

I am trying to get data from the request, I tried below-mentioned methods, I got None or {}. Here is what I tried,

request.form['text']
request.form.get('text')
request.form.to_dict()
request.form.getlist('text[]')
request.form.getlist('text')

I am sending json data using apid clies (Advanced Rest Client). Here is the data sample,

 [{
    "from": "971559xxxxxx",
    "id": "ABEGkZiAOQVVxxxxxxxxxxxxqEZ7KVtbxxxxx",
    "profile": {
        "name": "John Doe"
    },
    "text": {
        "body": "hi"
    },
    "timestamp": "1562080688",
    "type": "text",
    "to_number": "+971xxxxxxx"
    }]
KbiR
  • 4,047
  • 6
  • 37
  • 103

1 Answers1

1

If it send a json you can get it from

print(request.json) or print(request.get_json())

Reznik
  • 2,663
  • 1
  • 11
  • 31