Flask route with multiple methods

    0

    1

    Python Flask

    Library: flask

    Shortcut: flask.route.multiple-methods

    from flask import request
    
    @app.route('/myroute', methods=['GET', 'POST'])
    def login():
      if request.method == 'POST':
        form_value = request.form['form_name']
        return do_post()
      else:
        return do_get()
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.