@app.route('/ATGDataSubmission', methods=['POST'])
def ATGDataSubmissions():
print request.data //prints none
receivedData = request.form
print receivedData // prints ImmutableMultiDict([('ErrorMessage', u'Not able to connect'), ('SiteId', u'12345'), ('CommandResult', u'201'), ('IsSuccessfull', u'true')])//
我想获取字典数据。我必须使用哪种请求方法?
答案 0 :(得分:2)
致电to_dict
上的ImmutableMultiDict
:
>>> imd = ImmutableMultiDict([('ErrorMessage', u'Not able to connect'),
('SiteId', u'12345'), ('CommandResult', u'201'), ('IsSuccessfull', u'true')])
>>> imd.to_dict()
{'ErrorMessage': 'Not able to connect', 'SiteId': '12345', 'CommandResult': '201',
'IsSuccessfull': 'true'}