zoukankan      html  css  js  c++  java
  • curl如何发送json数据?如何发送form数据?python的restfull又该如何获取这些数据?

      1、python使用flask+flask_restfull框架写的api接口,做为服务

      2、curl 做为客户端发送数据

    from flask import request

    curl发送json的方法:curl -H "Content-Type: application/json" -X POST  --data '{"uid":"1"}'  http://127.0.0.1:8088/v1/intelli_press_end

    python的接收json的方法:uid = request.json.get('uid')

    curl发送form的方法:curl -X POST  --data 'uid=2&stop_type=normal'  http://127.0.0.1:8088/v1/intelli_press_end

    flask接收form的方法:uid = request.form['uid']

    参考:

    1、https://my.oschina.net/code33/blog/417424

    2、https://gist.github.com/subfuzion/08c5d85437d5d4f00e58

  • 相关阅读:
    助教小结4
    第二次作业
    助教小结5
    助教小结3
    work3
    助教小结1
    课后第一次作业
    助教小结2
    第一次团队作业
    悟透 JavaScript
  • 原文地址:https://www.cnblogs.com/shengulong/p/9131292.html
Copyright © 2011-2022 走看看