title: python3 flask: get multiple values for key in json post request
body: <p>I have a simple existing python API using flask that submits a post request in the body, then calls and executes another python script:</p>
  
  <p>testflask.py</p>
  
  <pre><code>import testlogicdf
  import json 
  from flask import Flask, json, request, Response
  app = Flask(__name__)
  
  
  @app.route("/results", methods=['POST'])
  def createResults():
    entry = request.get_json().get('entry', '')
    passcode = request.get_json().get('passcode', '')
  
  
    data = testlogicdf.test(entry, passcode)
    return Response(data, mimetype='application/json')    
  
  if __name__ == "__main__":
      app.run(debug = True, host='localhost', port=8080, passthrough_errors=False)
  </code></pre>
  
  <p>script that gets called: testlogicdf.py</p>
  
  <pre><code> import pandas as pd
  
  def passcodeMapping(entry):
    result = ''
    entry = int(entry)
    if (entry in range(1000, 3000)):       
      result = 'UKNOWN'
    elif (entry in range(0, 100)):
      result = 'Success'
    elif (entry in range(200, 999)):
      result = 'Error'
    return result
  
  def test(entry, passcode):
      df = pd.DataFrame()
      testInput = zip(entry, passcode)
      for entry, passcode in testInput:
          result = passcodeMapping(entry)
          df = df.append({'Entry': entry, 'Passcode': passcode, 'Second Attempt': result}, ignore_index=True)
      response = df.to_json(orient='records')
      return response
  </code></pre>
  
  <p>To achieve these results:</p>
  
  <pre><code> [
      {
          "Entry": 2442,
          "Passcode": "Restart",
          "Second Attempt": "UKNOWN"
      },
      {
          "Entry": 24,
          "Passcode": "Try Again",
          "Second Attempt": "Success"
      },
      {
          "Entry": 526,
          "Passcode": "Proceed",
          "Second Attempt": "Error"
      }
  ]
  </code></pre>
  
  <p>What I am trying to accomplish is instead of passing this in the request body:</p>
  
  <pre><code>{
  "entry":[2442, 24, 526],
  "passcode":["Restart", "Try Again", "Proceed"]
  }
  </code></pre>
  
  <p>I want to pass this to the API </p>
  
  <pre><code>[{
      "entry": "2442",
      "passcode": "Restart"
  }, {
      "entry": "24",
      "passcode": "Try Again"
  }, {
      "entry": "526",
      "passcode": "Proceed"
  }]
  </code></pre>
  
  <p>as this is more cleaner and self explanatory. However the issue I am having is when passing that request to my api, I am getting the error "AttributeError: 'list' object has no attribute 'get'"</p>
  
  <p>I've had no luck debugging why I'm not able to pass my request body in that format. Thanks in advance</p>