推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
EricNirvana
V2EX  ›  Python

自己撸了一个 web 框架,目标是快速开发 restful 风格的 web api

  •  1
     
  •   EricNirvana · May 8, 2016 · 4314 views
    This topic created in 3800 days ago, the information mentioned may be changed or developed.

    自己撸了一个 web 框架,项目名字是 Puck ,玩过 dota 的都知道~
    目标是快速开发 restful 风格的 web api ,地址 https://github.com/EricQAQ/Puck

    目前项目开发时间比较短,很多功能还有 bug ,文档还没有弄出来,只有简单的 example ,但是代码的注释比较齐全。

    求大神指导,互相学习~

    该项目的依赖包几乎只有 python 自带的标准库,只有少量的外部依赖~

    语法结构参考了 flask ,借鉴了 flask 的 context 机制

    使用 Puck 很方便:

    from puck import Puck, api_response, request
    
    app = Puck()
    
    @app.route('/', methods=['GET'])
    def hello():
        return api_response(
            data={
                'test': 'hello world!'
            }
        )
    
    if __name__ == '__main__':
        app.run()
    
    

    这样就可以返回一个 json 对象了~

    6 replies  •  2016-05-14 23:35:09 +08:00
    EricNirvana
        1
    EricNirvana  
    OP
       May 10, 2016
    Version 0.1.2 已发布~

    安装: pip install pucks

    教程在 https://github.com/EricQAQ/Puck/wiki

    欢迎提 bug~
    pierre1994
        2
    pierre1994  
       May 13, 2016
    弱弱问一下,权限认证和加密传输是否涉及额
    hjcpnr
        3
    hjcpnr  
       May 14, 2016
    不错不错,楼主,我也撸了一个框架,有兴趣一起交流啊!
    https://bitbucket.org/hjcpn/webuilder
    EricNirvana
        4
    EricNirvana  
    OP
       May 14, 2016
    @pierre1994 你指的权限认证是类似登陆,然后是接口访问权限吗,其实可以通过种 cookie 的方式解决?
    EricNirvana
        5
    EricNirvana  
    OP
       May 14, 2016
    @hjcpnr 恩恩 互相学习~ 另外 在 0.1.3 里面我支持了 restful 风格的接口的编写,可以按照自己的需求规定参数及其类型,详情可以看 0.1.3 里面的 example~
    Fing
        6
    Fing  
       May 14, 2016
    感谢好厉害的样子,已 fork
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2229 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 10:10 · PVG 18:10 · LAX 03:10 · JFK 06:10
    ♥ Do have faith in what you're doing.