ms133 发表于 2018-8-8 13:48:56

使用 Python & Flask 实现 RESTful Web API-Python & Golang 学习

  生活就是一块调色板,你选择了你喜欢的色彩,那么其色就更加美丽,人生也是这样,你选择了你喜欢的道路,你才有激情走出你的精彩人生。
  环境安装
  

  Flask 是一个 Python 的微服务的框架,基于 Werkzeug, 一个 WSGI 类库。
  Flask 优点:

[*]  Written in Python (that can be an advantage);
[*]  Simple to use;
[*]  Flexible;
[*]  Multiple good deployment options;
[*]  RESTful request dispatching

  一个响应 /articles 和 /articles/:id的 API 服务:
  

  请求
  

  响应




  请求



  请求指定 request type
  



  请求指定 content type



  查看 response HTTP headers

  优化代码

  使用

  替换
  



  请求





  HTTPbasic authentication


  Debug

  Logging

  参考:
  http://Flask documentation(http://flask.pocoo.org/docs/0.12/)
  http://Flask snippets(http://flask.pocoo.org/snippets/)
  http://Werkzeug documentation(http://werkzeug.pocoo.org/docs/0.12/)
  http://curl manual(https://curl.haxx.se/docs/manual.html)
  作者:阿凡卢
  出处:http://www.cnblogs.com/luxiaoxun/
  本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
页: [1]
查看完整版本: 使用 Python & Flask 实现 RESTful Web API-Python & Golang 学习