Guest User

Untitled

a guest
Sep 24th, 2016
66
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # 不管post或get都可以用—>写restful用这个
  2. @app.route('/stars/v1.0/register', methods = ['POST'])
  3. def register():
  4. args = request.args if request.method == 'GET' else request.form
  5. a = args.get('password', None)
  6. print a
  7. return jsonify({'result':'ok'})
  8.  
  9.  
  10. # 取得post内的资料—>html用request.form + 参数名称 —>写html用这个(拿form的data)
  11. @app.route('/stars/v1.0/register', methods = ['POST'])
  12. def register():
  13. userName = request.form['userName']
  14. password = request.form['password']
  15. newUser = {'userName':userName, 'password':password}
  16. return jsonify({'result':'ok'})
RAW Paste Data