title: How to use flask request properly to retrieve data from JSON?
body: <p>I looked many questions similar to my title but I have not found any that had same problem as me yet. </p>
  
  <p>I did <code>requests.post</code> to post JSON to API restful server. Below is the snippet</p>
  
  <pre><code>import requests
  
  def upload_data():
      url = "http://127.0.0.1:8088/"
      data = {"value":"abc123"}
      response = requests.post(url, data=data)
  
      print response.status_code, response.reason, response.text
  
  upload_data()
  </code></pre>
  
  <p>And for the server side</p>
  
  <pre><code>from flask_restful import Api, Resource
  from flask import request
  
  class MyAPI(Resource):
      def get():
          pass
  
      def post(self):
          value = request.data['value']
          response_object = {
              'value':value
          }
  
          return response_object, 201
  </code></pre>
  
  <p>I was hoping to get the POST function to work by showing the result of <code>201 Created</code> with </p>
  
  <pre><code>{
      'value':'abc123'
  }
  </code></pre>
  
  <p>But whenever I run the script, it gives me error saying that </p>
  
  <pre><code>    value = request.data["value"]
  TypeError: string indices must be integers, not str
  </code></pre>
  
  <p>I am sorry if this is a bad question but if anyone could show me what I have been missing in this script, I really appreciate it. Thank you.</p>