flask change request method code example
Example 1: get requests method flask
import flask
app = flask.Flask('your_flask_env')
@app.route('/register', methods=['GET', 'POST'])
def register():
if flask.request.method == 'POST':
username = flask.request.values.get('user')
password = flask.request.values.get('pass')
your_register_routine(username, password)
else:
yourarg = flask.request.args.get('argname')
your_register_template_rendering(yourarg)
Example 2: get requests method flask
if request.method == 'POST':