#customer_phone
Explore tagged Tumblr posts
Text
'400 Bad Request' when post json in Flask
My application is very simple,
#@[email protected]('/preorders/json', methods=['POST'])def json_create_preorders(): #print request print 'test' #print request.json print request.mimetype print request.json print 'aaa',request.get_json(force=True) print request.json['product_id'] if not request.json or not 'product_id' in request.json or not 'customer_name' in request.json or not 'customer_phone' in request.json: abort(400) preorder=Preorder(request.json['customer_name'],request.json['customer_phone'],request.json['product_id']) db.session.add(preorder) db.session.commit() return jsonify({'status':'success'}), 201
POST json with curl,
curl -i -H "Content-Type: application/json" -X POST -d '{"product_id":"111", "customer_name"="xiaokun", "customer_phone"="1231"}' http://xxxx/preorders/json
Check from server, 'test' and 'request.mimetype' are printed. Then is a 400 response.Anyone can help to have a look?
https://codehunter.cc/a/flask/400-bad-request-when-post-json-in-flask
0 notes
Photo
#Phone #Samsung_Phone #Mobile_Phone #Customer_Phone #Chaia_Phone #Beautiful_Phone #Airphone #New_Phone #Mobile #Mobile_Sell #Mouse_Mouse #Huawei #Huawei # Xiaomi #ShiamayatRayGate #Symphone_Iphone #Info #Iphone #Iphone #Iphone #Iphone #Advertising #Beautiful #Technology #Photo_Frame #Hycopy https://www.instagram.com/p/CBuHN26g_21/?igshid=redlylm5rh61
#phone#samsung_phone#mobile_phone#customer_phone#chaia_phone#beautiful_phone#airphone#new_phone#mobile#mobile_sell#mouse_mouse#huawei#shiamayatraygate#symphone_iphone#info#iphone#advertising#beautiful#technology#photo_frame#hycopy
0 notes