zoukankan      html  css  js  c++  java
  • flask接口传参

    一、get请求

    页面请求地址:http://127.0.0.1:5000/test/5?username=test

    视图函数接口路径:/test/<int:id>

    postman传递参数:使用GET请求方式传参

    注意:既可以获取路径上的参数也可以获取postman传递的参数

    二、post请求

    页面请求地址:http://127.0.0.1:5000/test/5

    视图函数接口:/test/<int:id>

    postman传递参数:使用post请求方式传参(post传参的好处在于不会将参数放在路径上)

    注意:post传递json格式参数需要使用json.loads(request.get_data)接收并序列化参数

  • 相关阅读:
    isequal 和startswith 使用
    UVa10340
    UVa1368
    UVa455
    UVa1225
    UVa1586
    UVa 1585
    UVa10082
    UVa272
    NYOJ1
  • 原文地址:https://www.cnblogs.com/wangcuican/p/13612250.html
Copyright © 2011-2022 走看看