Flask request.args.get get all params (Python)

前端 未结 2 1953
孤独总比滥情好
孤独总比滥情好 2021-01-02 06:34

how i can parse all GET params from URL in flask? I tried use request.args.get, but it works with specific GET params (pre defined), but i need parse it al

相关标签:
2条回答
  • 2021-01-02 07:26

    If you use request.args it will provide a dictonary with key-value pairs of the GET parameters

    Ex: http://website.com/index?arg1=hello&arg2=world

    print request.args
    >> {"arg1": "hello", "arg2": "world"}
    

    The request.args.get(key) is a useful dictionary function that will return None if the parameter is not set rather than raising a KeyError

    0 讨论(0)
  • 2021-01-02 07:30
    [i for i in request.args.keys()]
    
    0 讨论(0)
提交回复
热议问题