15 Star 36 Fork 10

Makefile君 / falsy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

falsy

FAL.S.Y

description

it's an api framework.
using falcon, swagger, yaml together!

license

MIT and Apache v2

showtime

ScreenShot

how to install it

pip install falsy

how to use it

  1. create the dir for static

    mkdir static

  2. writting the server code(main.py)

    from falsy.falsy import FALSY
    
    f = FALSY()   #you need create the dir called static before you run
    f.swagger('test.yml', ui=True, theme='impress') #impress theme is the responsive swagger ui, or you can use 'normal' here
    api = f.api
  3. writting the yml file

    swagger: '2.0'
    info:
    title: FALSY SIMPLE DEMO API
    version: "0.1"
    consumes:
    - application/json
    produces:
    - application/json
    basePath: "/v1"
    paths:
      '/hello':
        get:
          tags: [Method]
          operationId: demo.get_it
          summary: testing
          parameters:
            - name: name
              in: query
              type: string
              default: 'john'
          responses:
            200:
              description: Return response
  4. writting the operation handler(demo.py)

    def get_it(name):
        return {
            'get': name
        }
  5. run it

    gunicorn -b 0.0.0.0:8001 main:api --reload -w 1 --threads 1

  6. visit the ui page

    http://0.0.0.0:8001/v1/ui/ make sure it ends with '/'

video demo

ScreenShot

extensions

there some improvements compare to standard swagger, 
you can define `operationId` for handler, 'beforeId' and 'afterId' for aop hooks,
and 'validationId' for validator, see the files in demo dir for details.
MIT License Copyright (c) 2017 Makefile君 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

简单的swagger开发框架(ui和后端一体,配置神码的写一遍就够了),结合了falcon的性能与swagger和yml的方便性,让你开发api更轻松. 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/pingf/falsy.git
git@gitee.com:pingf/falsy.git
pingf
falsy
falsy
master

搜索帮助