My Flask web service has this code:
@app.route('/api/my_service', methods=['GET', 'POST'])
def my_service():
try:
content = request.get_json()
print type(content)
print 'content', content
except:
print sys.exc_info()
My client calls this:
input = {'my_key': 1, 'other_key': 2}
url ='http://local:5000/api/my_service'
res = requests.post(url, json=input)
if res.ok:
print res.text
The output is this
content {u'my_key': 1, u'other_key': 2}
It looks like my dictionary is being converted incorrectly. How can I trouble-shoot this?