1

I needed to POST a dictionary using Klein

from klein import Klein

import json

app = Klein()

dictionaries=[]

@app.route('/dict',methods=['POST'])

@inlineCallbacks

def pg_root():

dictionary = {'key' :request.json['name']}

dictionaries.append(dictionary)

return jsonify({'dictionaries': dictionary})

app.run("localhost",8080)

I dont think the funtion jsonify works here in klein. Please find an alternative.

Sana Hameed
  • 81
  • 1
  • 5

0 Answers0