├── .gitignore ├── LICENSE ├── README.md ├── README.rst ├── demo.gif ├── demo ├── __init__.py ├── catch │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ ├── spec.yml │ └── static │ │ └── spec.json ├── celery │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── readme.md │ ├── serve.py │ ├── spec.yml │ └── task │ │ ├── __init__.py │ │ ├── celeryconfig.py │ │ ├── config.py │ │ ├── main.py │ │ ├── run.py │ │ └── tasks.py ├── cookie │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ ├── spec.yml │ └── static │ │ ├── demo_cookie_spec.json │ │ ├── spec.json │ │ ├── spec1.json │ │ └── spec2.json ├── easy │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ └── spec.yml ├── global_ba │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ ├── spec.yml │ └── static │ │ └── spec.json ├── json │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ └── spec.yml ├── mm │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ ├── hello.py │ │ └── validate.py │ ├── serve.py │ └── spec.yml ├── mm2 │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ └── spec.yml ├── multi │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ ├── spec1.yml │ ├── spec2.yml │ └── static │ │ ├── spec.json │ │ ├── spec1.json │ │ └── spec2.json ├── no_param │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ ├── spec.yml │ └── static │ │ └── spec.json ├── plain_post │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ ├── spec.yml │ └── static │ │ └── spec.json ├── simple │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ ├── spec.yml │ └── static │ │ └── spec.json ├── split │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ ├── static │ │ └── spec.json │ └── ymls │ │ ├── get.yml │ │ ├── post.yml │ │ └── spec.yml ├── valid │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ ├── spec.yml │ └── static │ │ └── spec.json ├── webargs │ ├── __init__.py │ ├── ops │ │ ├── __init__.py │ │ └── hello.py │ ├── serve.py │ └── spec.yml └── with_wsgi │ ├── __init__.py │ ├── ops │ ├── __init__.py │ ├── flask.py │ ├── hello.py │ └── tornado.py │ ├── serve.py │ ├── spec.yml │ └── static │ └── demo_with_flask_spec.json ├── falsy.gif ├── falsy ├── __init__.py ├── falsy.py ├── jlog │ ├── __init__.py │ ├── filters.py │ ├── formatters.py │ ├── jlog.py │ └── test.py ├── loader │ ├── __init__.py │ ├── func.py │ ├── task.py │ └── yaml.py ├── netboy │ ├── __init__.py │ ├── chromeboy.py │ ├── curl_loop.py │ ├── curl_result.py │ ├── fetch.py │ ├── netboy.py │ ├── one.py │ ├── request.py │ ├── run.py │ ├── simple.py │ └── utils.py ├── swagger_proxy │ ├── __init__.py │ ├── middleware.py │ ├── operator_loader.py │ ├── spec_loader.py │ ├── swagger_server.py │ └── vendors │ │ ├── dist_bootstrap │ │ ├── 1.json │ │ ├── index.html │ │ ├── menu.json │ │ └── webjars │ │ │ └── drore-document-ui │ │ │ ├── ace │ │ │ ├── ace.min.css │ │ │ ├── ace.min.js │ │ │ └── bootstrap.min.js │ │ │ ├── bootstrap │ │ │ ├── css │ │ │ │ ├── bootstrap.min.css │ │ │ │ └── bootstrap.min.css.map │ │ │ ├── fonts │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ └── js │ │ │ │ ├── bootstrap.js │ │ │ │ ├── bootstrap.min.js │ │ │ │ └── npm.js │ │ │ ├── drore │ │ │ ├── DApiUI.js │ │ │ ├── DUI.css │ │ │ └── DUI.js │ │ │ ├── images │ │ │ └── api.ico │ │ │ ├── jquery │ │ │ └── jquery-1.9.1.min.js │ │ │ └── jsonview │ │ │ ├── jquery.jsonview.min.css │ │ │ └── jquery.jsonview.min.js │ │ ├── dist_impress │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon.ico │ │ ├── images │ │ │ ├── clippy.svg │ │ │ ├── noun-117716-404-error.svg │ │ │ └── throbber.gif │ │ ├── index.html │ │ ├── lib-1a1ca116de.css │ │ ├── lib-bc714383a4.js │ │ ├── lib │ │ │ ├── html5shiv.min.js │ │ │ └── raven.min.js │ │ ├── min-2aa5fc9ecf.css │ │ ├── min-bef83194c8.css.map │ │ ├── o2c.html │ │ ├── petstore.json │ │ ├── swagger-ui-1bdbffccc1.min.js.map │ │ └── swagger-ui-8cca51eac5.min.js │ │ ├── dist_material │ │ ├── auth.html │ │ ├── auth.json │ │ ├── index.html │ │ ├── plugins │ │ │ ├── after-explorer │ │ │ │ ├── xml-formatter.js │ │ │ │ └── xml-formatter.min.js │ │ │ ├── before-display │ │ │ │ ├── markdown.js │ │ │ │ ├── markdown.min.js │ │ │ │ ├── operations.js │ │ │ │ ├── operations.min.js │ │ │ │ ├── sort.js │ │ │ │ └── sort.min.js │ │ │ ├── before-explorer │ │ │ │ ├── auth.sample.js │ │ │ │ ├── auth.sample.min.js │ │ │ │ ├── transform.js │ │ │ │ └── transform.min.js │ │ │ ├── before-load │ │ │ │ ├── yaml.js │ │ │ │ └── yaml.min.js │ │ │ ├── before-parse │ │ │ │ ├── base.js │ │ │ │ ├── base.min.js │ │ │ │ ├── external-references.js │ │ │ │ ├── external-references.min.js │ │ │ │ ├── split.js │ │ │ │ ├── split.min.js │ │ │ │ ├── swagger-1-to-2.js │ │ │ │ └── swagger-1-to-2.min.js │ │ │ ├── plugins.js │ │ │ └── plugins.min.js │ │ ├── scripts │ │ │ ├── swagger-ui-material.core.js │ │ │ ├── swagger-ui-material.core.min.js │ │ │ ├── swagger-ui-material.full.js │ │ │ ├── swagger-ui-material.full.min.js │ │ │ ├── swagger-ui-material.js │ │ │ ├── swagger-ui-material.min.js │ │ │ ├── swagger-ui-material.templates.js │ │ │ └── swagger-ui-material.templates.min.js │ │ └── styles │ │ │ ├── swagger-ui-material.css │ │ │ └── swagger-ui-material.min.css │ │ └── dist_normal │ │ ├── css │ │ ├── print.css │ │ ├── reset.css │ │ ├── screen.css │ │ ├── style.css │ │ └── typography.css │ │ ├── fonts │ │ ├── DroidSans-Bold.ttf │ │ └── DroidSans.ttf │ │ ├── images │ │ ├── collapse.gif │ │ ├── expand.gif │ │ ├── explorer_icons.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon.ico │ │ ├── logo_small.png │ │ ├── pet_store_api.png │ │ ├── throbber.gif │ │ └── wordnik_api.png │ │ ├── index.html │ │ ├── lang │ │ ├── ca.js │ │ ├── el.js │ │ ├── en.js │ │ ├── es.js │ │ ├── fr.js │ │ ├── geo.js │ │ ├── it.js │ │ ├── ja.js │ │ ├── ko-kr.js │ │ ├── pl.js │ │ ├── pt.js │ │ ├── ru.js │ │ ├── tr.js │ │ ├── translator.js │ │ └── zh-cn.js │ │ ├── lib │ │ ├── backbone-min.js │ │ ├── es5-shim.js │ │ ├── handlebars-4.0.5.js │ │ ├── highlight.9.1.0.pack.js │ │ ├── highlight.9.1.0.pack_extended.js │ │ ├── jquery-1.8.0.min.js │ │ ├── jquery.ba-bbq.min.js │ │ ├── jquery.slideto.min.js │ │ ├── jquery.wiggle.min.js │ │ ├── js-yaml.min.js │ │ ├── jsoneditor.min.js │ │ ├── lodash.min.js │ │ ├── marked.js │ │ ├── object-assign-pollyfill.js │ │ ├── sanitize-html.min.js │ │ └── swagger-oauth.js │ │ ├── o2c.html │ │ └── swagger-ui.js ├── termcc │ ├── __init__.py │ └── termcc.py └── utils │ ├── __init__.py │ ├── decorator.py │ ├── marshmallow.py │ └── meta.py ├── requirements.txt ├── setup.cfg ├── setup.py └── tox.ini /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | **/*.pyc 3 | **/__pycache__ 4 | .ipynb_checkpoints/ 5 | *.ipynb 6 | static/* 7 | .tox/* 8 | dist/* 9 | static/* 10 | build/* 11 | *.egg* 12 | ChangeLog 13 | AUTHORS 14 | .python-version 15 | **/*.log* 16 | **/demo/**/*.json 17 | test.py 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Makefile君 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # falsy 2 | 3 | FAL.S.Y 4 | 5 | ### description 6 | 7 | it's an api framework. 8 | using falcon, swagger, yaml together! 9 | 10 | ### license 11 | 12 | MIT and Apache v2 13 | 14 | ### showtime 15 | 16 | ![ScreenShot](https://raw.githubusercontent.com/pingf/falsy/master/demo.gif) 17 | 18 | 19 | ### how to install it 20 | 21 | `pip install falsy` 22 | 23 | ### how to use it 24 | 25 | 0. create the dir for static 26 | 27 | `mkdir static` 28 | 29 | 1. writting the server code(main.py) 30 | 31 | ```python 32 | from falsy.falsy import FALSY 33 | 34 | f = FALSY() #you need create the dir called static before you run 35 | f.swagger('test.yml', ui=True, theme='impress') #impress theme is the responsive swagger ui, or you can use 'normal' here 36 | api = f.api 37 | ``` 38 | 39 | 2. writting the yml file 40 | 41 | ``` 42 | swagger: '2.0' 43 | info: 44 | title: FALSY SIMPLE DEMO API 45 | version: "0.1" 46 | consumes: 47 | - application/json 48 | produces: 49 | - application/json 50 | basePath: "/v1" 51 | paths: 52 | '/hello': 53 | get: 54 | tags: [Method] 55 | operationId: demo.get_it 56 | summary: testing 57 | parameters: 58 | - name: name 59 | in: query 60 | type: string 61 | default: 'john' 62 | responses: 63 | 200: 64 | description: Return response 65 | ``` 66 | 67 | 3. writting the operation handler(demo.py) 68 | 69 | ```python 70 | def get_it(name): 71 | return { 72 | 'get': name 73 | } 74 | ``` 75 | 76 | 4. run it 77 | 78 | `gunicorn -b 0.0.0.0:8001 main:api --reload -w 1 --threads 1` 79 | 80 | 5. visit the ui page 81 | 82 | `http://0.0.0.0:8001/v1/ui/` 83 | make sure it ends with '/' 84 | 85 | ### video demo 86 | 87 | ![ScreenShot](https://raw.githubusercontent.com/pingf/falsy/master/falsy.gif) 88 | 89 | ### extensions 90 | 91 | there some improvements compare to standard swagger, 92 | you can define `operationId` for handler, 'beforeId' and 'afterId' for aop hooks, 93 | and 'validationId' for validator, see the files in demo dir for details. 94 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | =============== 2 | FAL.S.Y 3 | =============== 4 | 5 | 6 | :Status: Alpha 7 | :Author: Jesse MENG (dameng/pingf) 8 | :Documentation: http://127.0.0.1/update_later 9 | 10 | 11 | using falcon with swagger-ui and yaml! 12 | 13 | :Basic Usage: 14 | 15 | .. code-block:: python 16 | 17 | from falsy.falsy import FALSY 18 | 19 | f = FALSY(static_path='test', static_dir='static') 20 | f.begin_api() 21 | f.swagger('test.yml', ui=True,theme='impress') 22 | f.end_api() 23 | api = f.api 24 | 25 | 26 | .. falsy: http://github.com 27 | 28 | Installation 29 | ============ 30 | 31 | :: 32 | 33 | pip install falsy 34 | 35 | 36 | License 37 | ======= 38 | 39 | Licensed under either of 40 | 41 | * Apache License, Version 2.0, 42 | (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) 43 | * MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT) 44 | at your option. 45 | 46 | ------------ 47 | Contribution 48 | ------------ 49 | 50 | Unless you explicitly state otherwise, any contribution intentionally 51 | submitted for inclusion in the work by you, as defined in the Apache-2.0 52 | license, shall be dual licensed as above, without any additional terms or 53 | conditions. -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo.gif -------------------------------------------------------------------------------- /demo/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | # from .test import test -------------------------------------------------------------------------------- /demo/catch/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/catch/__init__.py -------------------------------------------------------------------------------- /demo/catch/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/catch/ops/__init__.py -------------------------------------------------------------------------------- /demo/catch/ops/hello.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | import falcon 4 | 5 | from demo.catch.serve import CustomException 6 | 7 | 8 | def get_it(name): 9 | raise CustomException('haha') 10 | return { 11 | 'get': name 12 | } 13 | 14 | 15 | def post_it(name): 16 | raise CustomException('haha') 17 | return { 18 | 'post': name 19 | } 20 | 21 | 22 | def post_excp(req, resp, error): 23 | if type(error) == CustomException: 24 | resp.body = json.dumps({ 25 | 'error': 'hahah' 26 | }) 27 | resp.status = falcon.HTTP_500 28 | # raise error 29 | -------------------------------------------------------------------------------- /demo/catch/serve.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from falsy.falsy import FALSY 4 | 5 | 6 | class CustomException(Exception): 7 | pass 8 | 9 | 10 | def handle_custom(req, resp, e): 11 | resp.body = json.dumps({'error': 'custom error catched'}) 12 | resp.content_type = 'application/json' 13 | 14 | 15 | f = FALSY(static_path='test', static_dir='demo/catch/static') 16 | f.swagger('demo/catch/spec.yml', ui=True, theme='responsive',errors= {CustomException: handle_custom}) 17 | api = f.api 18 | -------------------------------------------------------------------------------- /demo/catch/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - application/json 9 | basePath: "/v1" 10 | paths: 11 | '/hello': 12 | get: 13 | tags: [Method] 14 | operationId: demo.catch.ops.hello.get_it 15 | summary: 测试get请求 16 | parameters: 17 | - name: name 18 | in: query 19 | type: string 20 | default: 'john' 21 | responses: 22 | 200: 23 | description: Return persons 24 | post: 25 | tags: [Method] 26 | operationId: demo.catch.ops.hello.post_it 27 | exceptionId: demo.catch.ops.hello.post_excp 28 | summary: 测试post请求 29 | parameters: 30 | - name: name 31 | in: query 32 | type: string 33 | default: 'john' 34 | responses: 35 | 200: 36 | description: Return persons 37 | -------------------------------------------------------------------------------- /demo/catch/static/spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API", 8 | "version": "0.1" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "get": { 13 | "parameters": [ 14 | { 15 | "default": "john", 16 | "in": "query", 17 | "name": "name", 18 | "type": "string" 19 | } 20 | ], 21 | "responses": { 22 | "200": { 23 | "description": "Return persons" 24 | } 25 | }, 26 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 27 | "tags": [ 28 | "Method" 29 | ] 30 | }, 31 | "post": { 32 | "parameters": [ 33 | { 34 | "default": "john", 35 | "in": "query", 36 | "name": "name", 37 | "type": "string" 38 | } 39 | ], 40 | "responses": { 41 | "200": { 42 | "description": "Return persons" 43 | } 44 | }, 45 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 46 | "tags": [ 47 | "Method" 48 | ] 49 | } 50 | } 51 | }, 52 | "produces": [ 53 | "application/json" 54 | ], 55 | "swagger": "2.0" 56 | } -------------------------------------------------------------------------------- /demo/celery/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/celery/__init__.py -------------------------------------------------------------------------------- /demo/celery/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/celery/ops/__init__.py -------------------------------------------------------------------------------- /demo/celery/ops/hello.py: -------------------------------------------------------------------------------- 1 | from falsy.jlog.jlog import JLog 2 | from falsy.loader import func, task 3 | 4 | log = JLog().bind() 5 | 6 | 7 | def post_it(name): 8 | log.debug('post it') 9 | payload = { 10 | 'type': 'normal', 11 | 'tasks': [ 12 | { 13 | "args": [ 14 | { 15 | 'url': 'http://www.baidu.com', 16 | 'dns_servers': '114.114.114.114', 17 | 'post_func': 'demo.celery.task.tasks.post_func' 18 | }, 19 | { 20 | 'url': 'http://www.douban.com', 21 | 'dns_servers': '114.114.114.114' 22 | }, 23 | ], 24 | "ids": ["demo.celery.task.tasks.crawl"], 25 | }, 26 | { 27 | "args": [ 28 | { 29 | 'url': 'http://www.google.com', 30 | }, 31 | ], 32 | "ids": ["demo.celery.task.tasks.crawl"], 33 | }, 34 | ], 35 | 'callback': "demo.celery.task.tasks.callback" 36 | } 37 | res = task.loads(payload).delay() 38 | return { 39 | 'post': name 40 | } 41 | -------------------------------------------------------------------------------- /demo/celery/readme.md: -------------------------------------------------------------------------------- 1 | #run woker 2 | 3 | ``` 4 | python -m demo.celery.task.main worker -l info -n w1 5 | ``` 6 | 7 | 8 | #trigger 9 | 10 | ``` 11 | gunicorn -b 0.0.0.0:8005 demo.celery.serve:api -w 1 --reload 12 | `` -------------------------------------------------------------------------------- /demo/celery/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/celery/static',log_config={'highlights':['falsy']}) 4 | f.swagger('demo/celery/spec.yml', ui=True, ui_language='zh-cn', theme='impress', cors_origin='*') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/celery/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - text/html 9 | - application/json 10 | basePath: "/v1" 11 | paths: 12 | '/hello': 13 | post: 14 | tags: [POST] 15 | operationId: demo.celery.ops.hello.post_it 16 | summary: 测试post请求 17 | parameters: 18 | - name: name 19 | in: query 20 | type: string 21 | default: 'jesse' 22 | responses: 23 | 200: 24 | description: Return response 25 | -------------------------------------------------------------------------------- /demo/celery/task/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/celery/task/__init__.py -------------------------------------------------------------------------------- /demo/celery/task/celeryconfig.py: -------------------------------------------------------------------------------- 1 | import os 2 | import socket 3 | 4 | ENV_IP = os.environ.get('ENV_IP', '127.0.0.1') 5 | ip = ENV_IP 6 | if '.' not in ip: 7 | ip = [(s.connect(('223.5.5.5', 53)), s.getsockname()[0], s.close()) for s in 8 | [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1] 9 | 10 | broker_pwd = result_pwd = 'xxxxx' 11 | broker_url = os.environ.get('CELERY_BROKER_URL', 'amqp://dameng:' + broker_pwd + '@' + ip + '/ymon') 12 | result_backend = os.environ.get('CELERY_RESULT_URL', 'redis://:' + result_pwd + '@' + ip + ':6379/2') 13 | 14 | task_serializer = 'msgpack' 15 | result_serializer = 'json' 16 | accept_content = ['json', 'msgpack'] 17 | timezone = 'UTC' 18 | enable_utc = True 19 | -------------------------------------------------------------------------------- /demo/celery/task/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | import socket 3 | 4 | ENV_IP = os.environ.get('ENV_IP', '127.0.0.1') 5 | ip = [(s.connect(('223.5.5.5', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1] 6 | # if ENV == 'SOC': 7 | # ip = '192.168.199.221' 8 | if ENV_IP != '127.0.0.1': 9 | ip = ENV_IP 10 | -------------------------------------------------------------------------------- /demo/celery/task/main.py: -------------------------------------------------------------------------------- 1 | from celery import Celery 2 | 3 | 4 | app = Celery('ymon', include=['demo.celery.task.tasks']) 5 | app.config_from_object('demo.celery.task.celeryconfig') 6 | 7 | 8 | if __name__ == '__main__': 9 | app.start() -------------------------------------------------------------------------------- /demo/celery/task/run.py: -------------------------------------------------------------------------------- 1 | from time import sleep 2 | 3 | from celery import group, chain, chord 4 | from celery.result import AsyncResult 5 | 6 | # from ymon.loader.task import loads 7 | from .main import app 8 | 9 | from falsy.loader import func, task 10 | from .tasks import add, on_chord_error 11 | 12 | 13 | 14 | if __name__ == '__main__': 15 | payload = { 16 | 'tasks': [ 17 | {"args": "haha", "ids": ["demo.celery.task.tasks.test2"], "on_error": "demo.celery.task.tasks.on_chord_error"}, 18 | ], 19 | 'callback': "demo.celery.task.tasks.callback" 20 | } 21 | res = task.loads(payload).delay() 22 | sleep(3) 23 | print(res.result, res.state) 24 | print(res, type(res), dir(res)) 25 | print(res.id) 26 | -------------------------------------------------------------------------------- /demo/celery/task/tasks.py: -------------------------------------------------------------------------------- 1 | import json 2 | from time import sleep 3 | 4 | from celery import current_task 5 | from celery.task import Task 6 | 7 | from demo.celery.task.main import app 8 | # from demo.celery.task.util.context_decorator import log_runtime 9 | from falsy.netboy.curl_loop import CurlLoop 10 | from falsy.netboy.fetch import get_boy 11 | from falsy.netboy.run import run 12 | from falsy.utils.decorator import redirect_exceptions, log_runtime 13 | 14 | class ExampleException(Exception): 15 | pass 16 | 17 | 18 | def catch(et, ev, es): 19 | print(et, ev, 'catched') 20 | return True 21 | 22 | 23 | @app.task(bind=True, max_retries=3) 24 | @log_runtime(label='hahaha') 25 | @redirect_exceptions(to='demo.celery.task.tasks.catch',exceptions=(Exception)) 26 | def crawl(self, urls): 27 | ress=run(get_boy(urls)) 28 | print(type(ress)) 29 | print(ress) 30 | for res in ress: 31 | if type(res) == CurlLoop.Exception: 32 | print('curl error') 33 | continue 34 | if res is None: 35 | print('res is None') 36 | continue 37 | res['data'] = res['data'][:80] 38 | print(json.dumps(res, indent=2)) 39 | return '>>>' 40 | 41 | 42 | 43 | @app.task(bind=True) 44 | def callback(self, s): 45 | print(s) 46 | return None 47 | 48 | 49 | @app.task 50 | def on_chord_error(request, exc, traceback): 51 | print('!' * 400) 52 | # print('Task {0!r} raised error: {1!r}'.format(request.id, exc)) 53 | return True 54 | 55 | 56 | @app.task(name='super_task.error_callback') 57 | def error_callback(*args, **kwargs): 58 | print('error_callback') 59 | # print(args) 60 | # print(kwargs) 61 | return None 62 | # return 'error' 63 | 64 | def post_func(payload, resp): 65 | print('post func called') 66 | print(resp) 67 | return resp 68 | -------------------------------------------------------------------------------- /demo/cookie/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/cookie/__init__.py -------------------------------------------------------------------------------- /demo/cookie/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/cookie/ops/__init__.py -------------------------------------------------------------------------------- /demo/cookie/ops/hello.py: -------------------------------------------------------------------------------- 1 | def get_it(name, id): 2 | return { 3 | 'get1': name, 4 | 'get2': id 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/cookie/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/cookie/static') 4 | f.swagger('demo/cookie/spec.yml', ui=True, ui_language='zh-cn', theme='normal') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/cookie/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API v1 4 | version: "0.2" 5 | consumes: 6 | - application/json 7 | produces: 8 | - application/json 9 | basePath: "/v1" 10 | enableCookies: true 11 | paths: 12 | '/hello': 13 | get: 14 | tags: [Method] 15 | operationId: demo.cookie.ops.hello.get_it 16 | summary: 测试get请求 17 | parameters: 18 | - name: name 19 | in: header 20 | type: string 21 | default: 'john' 22 | - name: id 23 | in: header 24 | type: string 25 | default: '123' 26 | responses: 27 | 200: 28 | description: Return response 29 | -------------------------------------------------------------------------------- /demo/cookie/static/demo_cookie_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "enableCookies": true, 7 | "info": { 8 | "title": "FALSY SIMPLE DEMO API v1", 9 | "version": "0.2" 10 | }, 11 | "paths": { 12 | "/hello": { 13 | "get": { 14 | "parameters": [ 15 | { 16 | "default": "john", 17 | "in": "header", 18 | "name": "name", 19 | "type": "string" 20 | }, 21 | { 22 | "default": "123", 23 | "in": "header", 24 | "name": "id", 25 | "type": "string" 26 | } 27 | ], 28 | "responses": { 29 | "200": { 30 | "description": "Return response" 31 | } 32 | }, 33 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 34 | "tags": [ 35 | "Method" 36 | ] 37 | } 38 | } 39 | }, 40 | "produces": [ 41 | "application/json" 42 | ], 43 | "swagger": "2.0" 44 | } -------------------------------------------------------------------------------- /demo/cookie/static/spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API", 8 | "version": "0.1" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "delete": { 13 | "operationId": "demo.simple.ops.hello.delete_it", 14 | "parameters": [ 15 | { 16 | "default": "john", 17 | "in": "query", 18 | "name": "name", 19 | "type": "string" 20 | } 21 | ], 22 | "responses": { 23 | "200": { 24 | "description": "Return response" 25 | } 26 | }, 27 | "summary": "\u6d4b\u8bd5delete\u8bf7\u6c42", 28 | "tags": [ 29 | "Method" 30 | ] 31 | }, 32 | "get": { 33 | "operationId": "demo.simple.ops.hello.get_it", 34 | "parameters": [ 35 | { 36 | "default": "john", 37 | "in": "query", 38 | "name": "name", 39 | "type": "string" 40 | } 41 | ], 42 | "responses": { 43 | "200": { 44 | "description": "Return response" 45 | } 46 | }, 47 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 48 | "tags": [ 49 | "Method" 50 | ] 51 | }, 52 | "patch": { 53 | "operationId": "demo.simple.ops.hello.patch_it", 54 | "parameters": [ 55 | { 56 | "default": "john", 57 | "in": "query", 58 | "name": "name", 59 | "type": "string" 60 | } 61 | ], 62 | "responses": { 63 | "200": { 64 | "description": "Return response" 65 | } 66 | }, 67 | "summary": "\u6d4b\u8bd5patch\u8bf7\u6c42", 68 | "tags": [ 69 | "Method" 70 | ] 71 | }, 72 | "post": { 73 | "operationId": "demo.simple.ops.hello.post_it", 74 | "parameters": [ 75 | { 76 | "default": "john", 77 | "in": "query", 78 | "name": "name", 79 | "type": "string" 80 | } 81 | ], 82 | "responses": { 83 | "200": { 84 | "description": "Return response" 85 | } 86 | }, 87 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 88 | "tags": [ 89 | "Method" 90 | ] 91 | }, 92 | "put": { 93 | "operationId": "demo.simple.ops.hello.put_it", 94 | "parameters": [ 95 | { 96 | "default": "john", 97 | "in": "query", 98 | "name": "name", 99 | "type": "string" 100 | } 101 | ], 102 | "responses": { 103 | "200": { 104 | "description": "Return response" 105 | } 106 | }, 107 | "summary": "\u6d4b\u8bd5put\u8bf7\u6c42", 108 | "tags": [ 109 | "Method" 110 | ] 111 | } 112 | } 113 | }, 114 | "produces": [ 115 | "application/json" 116 | ], 117 | "swagger": "2.0" 118 | } -------------------------------------------------------------------------------- /demo/cookie/static/spec1.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1/raw", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API v1", 8 | "version": "0.2" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "get": { 13 | "parameters": [ 14 | { 15 | "default": "john", 16 | "in": "query", 17 | "name": "name", 18 | "type": "string" 19 | } 20 | ], 21 | "responses": { 22 | "200": { 23 | "description": "Return response" 24 | } 25 | }, 26 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 27 | "tags": [ 28 | "Method" 29 | ] 30 | } 31 | } 32 | }, 33 | "produces": [ 34 | "application/json" 35 | ], 36 | "swagger": "2.0" 37 | } -------------------------------------------------------------------------------- /demo/cookie/static/spec2.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v2/ez", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API v2", 8 | "version": "0.2" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "get": { 13 | "parameters": [ 14 | { 15 | "default": "john", 16 | "in": "query", 17 | "name": "name", 18 | "type": "string" 19 | } 20 | ], 21 | "responses": { 22 | "200": { 23 | "description": "Return response" 24 | } 25 | }, 26 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 27 | "tags": [ 28 | "Method" 29 | ] 30 | } 31 | } 32 | }, 33 | "produces": [ 34 | "application/json" 35 | ], 36 | "swagger": "2.0" 37 | } -------------------------------------------------------------------------------- /demo/easy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/easy/__init__.py -------------------------------------------------------------------------------- /demo/easy/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/easy/ops/__init__.py -------------------------------------------------------------------------------- /demo/easy/ops/hello.py: -------------------------------------------------------------------------------- 1 | import falcon 2 | import requests 3 | 4 | from falsy.jlog.jlog import JLog 5 | 6 | log = JLog().bind() 7 | 8 | def get_it(name): 9 | log.debug('get it') 10 | return { 11 | 'get': name 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /demo/easy/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/easy/static',log_config={'highlights':['falsy']}) 4 | f.swagger('demo/easy/spec.yml', ui=True, ui_language='zh-cn', theme='impress') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/easy/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - text/html 9 | - application/json 10 | basePath: "/v1" 11 | paths: 12 | '/hello': 13 | get: 14 | tags: [GET] 15 | operationId: demo.easy.ops.hello.get_it 16 | summary: 测试get请求 17 | parameters: 18 | - name: name 19 | in: query 20 | type: string 21 | default: 'john' 22 | responses: 23 | 200: 24 | description: Return response 25 | -------------------------------------------------------------------------------- /demo/global_ba/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/global_ba/__init__.py -------------------------------------------------------------------------------- /demo/global_ba/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/global_ba/ops/__init__.py -------------------------------------------------------------------------------- /demo/global_ba/ops/hello.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | def before_all(req, resp): 5 | resp.body = { 6 | 'method': req.method 7 | } 8 | 9 | 10 | def after_all(req, resp, response): 11 | jbody = json.loads(resp.body) 12 | jbody.update({'keys': [k for k in response.keys()]}) 13 | resp.body = json.dumps(jbody) 14 | 15 | 16 | def get_it(name): 17 | return { 18 | 'name': name 19 | } 20 | 21 | 22 | def post_it(name): 23 | return { 24 | 'name': name 25 | } 26 | 27 | 28 | def delete_it(name): 29 | return { 30 | 'name': name 31 | } 32 | 33 | 34 | def put_it(name): 35 | return { 36 | 'name': name 37 | } 38 | 39 | 40 | def patch_it(name): 41 | return { 42 | 'name': name 43 | } 44 | -------------------------------------------------------------------------------- /demo/global_ba/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/simple/static') 4 | f.swagger('demo/global_ba/spec.yml', ui=True, ui_language='zh-cn', theme='responsive') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/global_ba/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - application/json 9 | beforeId: demo.global_ba.ops.hello.before_all 10 | afterId: demo.global_ba.ops.hello.after_all 11 | basePath: "/v1" 12 | paths: 13 | '/hello': 14 | get: 15 | tags: [Method] 16 | operationId: demo.global_ba.ops.hello.get_it 17 | summary: 测试get请求 18 | parameters: 19 | - name: name 20 | in: query 21 | type: string 22 | default: 'john' 23 | responses: 24 | 200: 25 | description: Return response 26 | post: 27 | tags: [Method] 28 | operationId: demo.global_ba.ops.hello.post_it 29 | summary: 测试post请求 30 | parameters: 31 | - name: name 32 | in: query 33 | type: string 34 | default: 'john' 35 | responses: 36 | 200: 37 | description: Return response 38 | delete: 39 | tags: [Method] 40 | operationId: demo.global_ba.ops.hello.delete_it 41 | summary: 测试delete请求 42 | parameters: 43 | - name: name 44 | in: query 45 | type: string 46 | default: 'john' 47 | responses: 48 | 200: 49 | description: Return response 50 | put: 51 | tags: [Method] 52 | operationId: demo.global_ba.ops.hello.put_it 53 | summary: 测试put请求 54 | parameters: 55 | - name: name 56 | in: query 57 | type: string 58 | default: 'john' 59 | responses: 60 | 200: 61 | description: Return response 62 | patch: 63 | tags: [Method] 64 | operationId: demo.global_ba.ops.hello.patch_it 65 | summary: 测试patch请求 66 | parameters: 67 | - name: name 68 | in: query 69 | type: string 70 | default: 'john' 71 | responses: 72 | 200: 73 | description: Return response 74 | -------------------------------------------------------------------------------- /demo/global_ba/static/spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "afterId": "demo.simple.ops.hello.after_it", 3 | "basePath": "/v1", 4 | "consumes": [ 5 | "application/json" 6 | ], 7 | "info": { 8 | "title": "FALSY SIMPLE DEMO API", 9 | "version": "0.1" 10 | }, 11 | "paths": { 12 | "/hello": { 13 | "delete": { 14 | "operationId": "demo.simple.ops.hello.delete_it", 15 | "parameters": [ 16 | { 17 | "default": "john", 18 | "in": "query", 19 | "name": "name", 20 | "type": "string" 21 | } 22 | ], 23 | "responses": { 24 | "200": { 25 | "description": "Return persons" 26 | } 27 | }, 28 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 29 | "tags": [ 30 | "Get" 31 | ] 32 | }, 33 | "get": { 34 | "operationId": "demo.simple.ops.hello.get_it", 35 | "parameters": [ 36 | { 37 | "default": "john", 38 | "in": "query", 39 | "name": "name", 40 | "type": "string" 41 | } 42 | ], 43 | "responses": { 44 | "200": { 45 | "description": "Return persons" 46 | } 47 | }, 48 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 49 | "tags": [ 50 | "Get" 51 | ] 52 | }, 53 | "patch": { 54 | "operationId": "demo.simple.ops.hello.patch_it", 55 | "parameters": [ 56 | { 57 | "default": "john", 58 | "in": "query", 59 | "name": "name", 60 | "type": "string" 61 | } 62 | ], 63 | "responses": { 64 | "200": { 65 | "description": "Return persons" 66 | } 67 | }, 68 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 69 | "tags": [ 70 | "Get" 71 | ] 72 | }, 73 | "post": { 74 | "operationId": "demo.simple.ops.hello.post_it", 75 | "parameters": [ 76 | { 77 | "default": "john", 78 | "in": "query", 79 | "name": "name", 80 | "type": "string" 81 | } 82 | ], 83 | "responses": { 84 | "200": { 85 | "description": "Return persons" 86 | } 87 | }, 88 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 89 | "tags": [ 90 | "Get" 91 | ] 92 | }, 93 | "put": { 94 | "operationId": "demo.simple.ops.hello.put_it", 95 | "parameters": [ 96 | { 97 | "default": "john", 98 | "in": "query", 99 | "name": "name", 100 | "type": "string" 101 | } 102 | ], 103 | "responses": { 104 | "200": { 105 | "description": "Return persons" 106 | } 107 | }, 108 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 109 | "tags": [ 110 | "Get" 111 | ] 112 | } 113 | } 114 | }, 115 | "produces": [ 116 | "application/json" 117 | ], 118 | "swagger": "2.0" 119 | } -------------------------------------------------------------------------------- /demo/json/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/json/__init__.py -------------------------------------------------------------------------------- /demo/json/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/json/ops/__init__.py -------------------------------------------------------------------------------- /demo/json/ops/hello.py: -------------------------------------------------------------------------------- 1 | from falsy.jlog.jlog import JLog 2 | 3 | log = JLog().bind() 4 | 5 | 6 | def get_it(): 7 | log.debug('get it') 8 | return { 9 | 'hello': 'jesse' 10 | } 11 | -------------------------------------------------------------------------------- /demo/json/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/json/static') 4 | f.swagger('demo/json/spec.json', ui=True, ui_language='zh-cn', theme='impress') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/json/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - text/html 9 | - application/json 10 | basePath: "/v1" 11 | paths: 12 | '/hello': 13 | get: 14 | tags: [GET] 15 | operationId: demo.simple.ops.hello.get_it 16 | summary: 测试get请求 17 | parameters: 18 | - name: name 19 | in: query 20 | type: string 21 | default: 'john' 22 | responses: 23 | 200: 24 | description: Return response 25 | post: 26 | tags: [POST] 27 | operationId: demo.simple.ops.hello.post_it 28 | summary: 测试post请求 29 | parameters: 30 | - name: name 31 | in: query 32 | type: string 33 | default: 'john' 34 | responses: 35 | 200: 36 | description: Return response 37 | delete: 38 | tags: [DELETE] 39 | operationId: demo.simple.ops.hello.delete_it 40 | summary: 测试delete请求 41 | parameters: 42 | - name: name 43 | in: query 44 | type: string 45 | default: 'john' 46 | responses: 47 | 200: 48 | description: Return response 49 | put: 50 | tags: [PUT] 51 | operationId: demo.simple.ops.hello.put_it 52 | summary: 测试put请求 53 | parameters: 54 | - name: name 55 | in: query 56 | type: string 57 | default: 'john' 58 | responses: 59 | 200: 60 | description: Return response 61 | patch: 62 | tags: [PATCH] 63 | operationId: demo.simple.ops.hello.patch_it 64 | summary: 测试patch请求 65 | parameters: 66 | - name: name 67 | in: query 68 | type: string 69 | default: 'john' 70 | responses: 71 | 200: 72 | description: Return response 73 | -------------------------------------------------------------------------------- /demo/mm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/mm/__init__.py -------------------------------------------------------------------------------- /demo/mm/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/mm/ops/__init__.py -------------------------------------------------------------------------------- /demo/mm/ops/hello.py: -------------------------------------------------------------------------------- 1 | 2 | def get_it(name): 3 | return { 4 | 'get': name 5 | } 6 | 7 | 8 | def post_it(name): 9 | return { 10 | 'post': name 11 | } 12 | -------------------------------------------------------------------------------- /demo/mm/ops/validate.py: -------------------------------------------------------------------------------- 1 | from marshmallow import fields 2 | 3 | from falsy.utils.marshmallow import mm_check 4 | 5 | route_args = { 6 | '/get/v1/hello': { 7 | 'name': fields.Str(required=False), 8 | }, 9 | '/post/v1/hello': { 10 | 'name': fields.Str(validate=lambda p: len(p) >= 4) 11 | } 12 | } 13 | 14 | 15 | def mmcheck(req, resp, **kwargs): 16 | mm_check(route_args, req, **kwargs) 17 | -------------------------------------------------------------------------------- /demo/mm/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_dir='demo/mm/static') 4 | f.swagger('demo/mm/spec.yml', ui=True, ui_language='zh-cn', theme='impress') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/mm/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - text/html 9 | - application/json 10 | basePath: "/v1" 11 | beforeId: demo.mm.ops.validate.mmcheck 12 | paths: 13 | '/hello': 14 | get: 15 | tags: [GET] 16 | operationId: demo.mm.ops.hello.get_it 17 | summary: 测试get请求,mmcheck,小于6字符会报错 18 | parameters: 19 | - name: name 20 | in: query 21 | type: string 22 | default: 'jesse' 23 | responses: 24 | 200: 25 | description: Return response 26 | post: 27 | tags: [POST] 28 | operationId: demo.mm.ops.hello.post_it 29 | summary: 测试get请求,小于4字符会报错 30 | parameters: 31 | - name: name 32 | in: query 33 | type: string 34 | default: 'jesse' 35 | responses: 36 | 200: 37 | description: Return response 38 | -------------------------------------------------------------------------------- /demo/mm2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/mm2/__init__.py -------------------------------------------------------------------------------- /demo/mm2/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/mm2/ops/__init__.py -------------------------------------------------------------------------------- /demo/mm2/ops/hello.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from marshmallow import fields 4 | 5 | from falsy.utils.marshmallow import validate 6 | 7 | 8 | 9 | argmap = { 10 | 'name': fields.Str(required=False), 11 | } 12 | 13 | 14 | @validate(argmap) 15 | def get_it(**kwargs): 16 | return { 17 | 'get': kwargs.get('name') 18 | } 19 | 20 | 21 | def post_it(name): 22 | return { 23 | 'post': name 24 | } 25 | -------------------------------------------------------------------------------- /demo/mm2/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_dir='demo/mm2/static') 4 | f.swagger('demo/mm2/spec.yml', ui=True, ui_language='zh-cn', theme='impress') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/mm2/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - text/html 9 | - application/json 10 | basePath: "/v1" 11 | #exceptionId: demo.mm2.ops.hello.except_it 12 | paths: 13 | '/hello': 14 | get: 15 | tags: [GET] 16 | operationId: demo.mm2.ops.hello.get_it 17 | summary: 测试get请求,mmcheck,小于6字符会报错 18 | parameters: 19 | - name: name 20 | in: query 21 | type: string 22 | responses: 23 | 200: 24 | description: Return response 25 | post: 26 | tags: [POST] 27 | operationId: demo.mm2.ops.hello.post_it 28 | summary: 测试get请求,小于4字符会报错 29 | parameters: 30 | - name: name 31 | in: query 32 | type: string 33 | default: 'jesse' 34 | responses: 35 | 200: 36 | description: Return response 37 | -------------------------------------------------------------------------------- /demo/multi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/multi/__init__.py -------------------------------------------------------------------------------- /demo/multi/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/multi/ops/__init__.py -------------------------------------------------------------------------------- /demo/multi/ops/hello.py: -------------------------------------------------------------------------------- 1 | def get_it1(name): 2 | return { 3 | 'get1': name 4 | } 5 | 6 | def get_it2(name): 7 | return { 8 | 'get2': name 9 | } 10 | 11 | -------------------------------------------------------------------------------- /demo/multi/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/multi/static') 4 | f.swagger('demo/multi/spec1.yml', ui=True, ui_language='zh-cn', theme='normal') 5 | f.swagger('demo/multi/spec2.yml', ui=True, ui_language='zh-cn', theme='normal') 6 | api = f.api 7 | -------------------------------------------------------------------------------- /demo/multi/spec1.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API v1 4 | version: "0.2" 5 | consumes: 6 | - application/json 7 | produces: 8 | - application/json 9 | basePath: "/v1/raw" 10 | paths: 11 | '/hello': 12 | get: 13 | tags: [Method] 14 | operationId: demo.multi.ops.hello.get_it1 15 | summary: 测试get请求 16 | parameters: 17 | - name: name 18 | in: query 19 | type: string 20 | default: 'john' 21 | responses: 22 | 200: 23 | description: Return response 24 | -------------------------------------------------------------------------------- /demo/multi/spec2.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API v2 4 | version: "0.2" 5 | consumes: 6 | - application/json 7 | produces: 8 | - application/json 9 | basePath: "/v2/ez" 10 | paths: 11 | '/hello': 12 | get: 13 | tags: [Method] 14 | operationId: demo.multi.ops.hello.get_it2 15 | summary: 测试get请求 16 | parameters: 17 | - name: name 18 | in: query 19 | type: string 20 | default: 'john' 21 | responses: 22 | 200: 23 | description: Return response 24 | -------------------------------------------------------------------------------- /demo/multi/static/spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API", 8 | "version": "0.1" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "delete": { 13 | "operationId": "demo.simple.ops.hello.delete_it", 14 | "parameters": [ 15 | { 16 | "default": "john", 17 | "in": "query", 18 | "name": "name", 19 | "type": "string" 20 | } 21 | ], 22 | "responses": { 23 | "200": { 24 | "description": "Return response" 25 | } 26 | }, 27 | "summary": "\u6d4b\u8bd5delete\u8bf7\u6c42", 28 | "tags": [ 29 | "Method" 30 | ] 31 | }, 32 | "get": { 33 | "operationId": "demo.simple.ops.hello.get_it", 34 | "parameters": [ 35 | { 36 | "default": "john", 37 | "in": "query", 38 | "name": "name", 39 | "type": "string" 40 | } 41 | ], 42 | "responses": { 43 | "200": { 44 | "description": "Return response" 45 | } 46 | }, 47 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 48 | "tags": [ 49 | "Method" 50 | ] 51 | }, 52 | "patch": { 53 | "operationId": "demo.simple.ops.hello.patch_it", 54 | "parameters": [ 55 | { 56 | "default": "john", 57 | "in": "query", 58 | "name": "name", 59 | "type": "string" 60 | } 61 | ], 62 | "responses": { 63 | "200": { 64 | "description": "Return response" 65 | } 66 | }, 67 | "summary": "\u6d4b\u8bd5patch\u8bf7\u6c42", 68 | "tags": [ 69 | "Method" 70 | ] 71 | }, 72 | "post": { 73 | "operationId": "demo.simple.ops.hello.post_it", 74 | "parameters": [ 75 | { 76 | "default": "john", 77 | "in": "query", 78 | "name": "name", 79 | "type": "string" 80 | } 81 | ], 82 | "responses": { 83 | "200": { 84 | "description": "Return response" 85 | } 86 | }, 87 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 88 | "tags": [ 89 | "Method" 90 | ] 91 | }, 92 | "put": { 93 | "operationId": "demo.simple.ops.hello.put_it", 94 | "parameters": [ 95 | { 96 | "default": "john", 97 | "in": "query", 98 | "name": "name", 99 | "type": "string" 100 | } 101 | ], 102 | "responses": { 103 | "200": { 104 | "description": "Return response" 105 | } 106 | }, 107 | "summary": "\u6d4b\u8bd5put\u8bf7\u6c42", 108 | "tags": [ 109 | "Method" 110 | ] 111 | } 112 | } 113 | }, 114 | "produces": [ 115 | "application/json" 116 | ], 117 | "swagger": "2.0" 118 | } -------------------------------------------------------------------------------- /demo/multi/static/spec1.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1/raw", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API v1", 8 | "version": "0.2" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "get": { 13 | "parameters": [ 14 | { 15 | "default": "john", 16 | "in": "query", 17 | "name": "name", 18 | "type": "string" 19 | } 20 | ], 21 | "responses": { 22 | "200": { 23 | "description": "Return response" 24 | } 25 | }, 26 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 27 | "tags": [ 28 | "Method" 29 | ] 30 | } 31 | } 32 | }, 33 | "produces": [ 34 | "application/json" 35 | ], 36 | "swagger": "2.0" 37 | } -------------------------------------------------------------------------------- /demo/multi/static/spec2.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v2/ez", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API v2", 8 | "version": "0.2" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "get": { 13 | "parameters": [ 14 | { 15 | "default": "john", 16 | "in": "query", 17 | "name": "name", 18 | "type": "string" 19 | } 20 | ], 21 | "responses": { 22 | "200": { 23 | "description": "Return response" 24 | } 25 | }, 26 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 27 | "tags": [ 28 | "Method" 29 | ] 30 | } 31 | } 32 | }, 33 | "produces": [ 34 | "application/json" 35 | ], 36 | "swagger": "2.0" 37 | } -------------------------------------------------------------------------------- /demo/no_param/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/no_param/__init__.py -------------------------------------------------------------------------------- /demo/no_param/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/no_param/ops/__init__.py -------------------------------------------------------------------------------- /demo/no_param/ops/hello.py: -------------------------------------------------------------------------------- 1 | def get_it(): 2 | return { 3 | 'get': 'no param' 4 | } 5 | 6 | 7 | def post_it(): 8 | return { 9 | 'post': 'no param' 10 | } 11 | 12 | 13 | def delete_it(): 14 | return { 15 | 'delete': 'no param' 16 | } 17 | 18 | 19 | def put_it(): 20 | return { 21 | 'put': 'no param' 22 | } 23 | 24 | 25 | def patch_it(): 26 | return { 27 | 'patch': 'no param' 28 | } 29 | 30 | -------------------------------------------------------------------------------- /demo/no_param/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/no_param/static') 4 | f.swagger('demo/no_param/spec.yml', ui=True, ui_language='zh-cn', theme='responsive') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/no_param/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - application/json 9 | basePath: "/v1" 10 | paths: 11 | '/hello': 12 | get: 13 | tags: [Method] 14 | operationId: demo.no_param.ops.hello.get_it 15 | summary: 测试get请求 16 | responses: 17 | 200: 18 | description: Return response 19 | post: 20 | tags: [Method] 21 | operationId: demo.no_param.ops.hello.post_it 22 | summary: 测试post请求 23 | responses: 24 | 200: 25 | description: Return response 26 | delete: 27 | tags: [Method] 28 | operationId: demo.no_param.ops.hello.delete_it 29 | summary: 测试delete请求 30 | responses: 31 | 200: 32 | description: Return response 33 | put: 34 | tags: [Method] 35 | operationId: demo.no_param.ops.hello.put_it 36 | summary: 测试put请求 37 | responses: 38 | 200: 39 | description: Return response 40 | patch: 41 | tags: [Method] 42 | operationId: demo.no_param.ops.hello.patch_it 43 | summary: 测试patch请求 44 | responses: 45 | 200: 46 | description: Return response 47 | -------------------------------------------------------------------------------- /demo/no_param/static/spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API", 8 | "version": "0.1" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "delete": { 13 | "operationId": "demo.no_param.ops.hello.delete_it", 14 | "responses": { 15 | "200": { 16 | "description": "Return response" 17 | } 18 | }, 19 | "summary": "\u6d4b\u8bd5delete\u8bf7\u6c42", 20 | "tags": [ 21 | "Method" 22 | ] 23 | }, 24 | "get": { 25 | "operationId": "demo.no_param.ops.hello.get_it", 26 | "responses": { 27 | "200": { 28 | "description": "Return response" 29 | } 30 | }, 31 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 32 | "tags": [ 33 | "Method" 34 | ] 35 | }, 36 | "patch": { 37 | "operationId": "demo.no_param.ops.hello.patch_it", 38 | "responses": { 39 | "200": { 40 | "description": "Return response" 41 | } 42 | }, 43 | "summary": "\u6d4b\u8bd5patch\u8bf7\u6c42", 44 | "tags": [ 45 | "Method" 46 | ] 47 | }, 48 | "post": { 49 | "operationId": "demo.no_param.ops.hello.post_it", 50 | "responses": { 51 | "200": { 52 | "description": "Return response" 53 | } 54 | }, 55 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 56 | "tags": [ 57 | "Method" 58 | ] 59 | }, 60 | "put": { 61 | "operationId": "demo.no_param.ops.hello.put_it", 62 | "responses": { 63 | "200": { 64 | "description": "Return response" 65 | } 66 | }, 67 | "summary": "\u6d4b\u8bd5put\u8bf7\u6c42", 68 | "tags": [ 69 | "Method" 70 | ] 71 | } 72 | } 73 | }, 74 | "produces": [ 75 | "application/json" 76 | ], 77 | "swagger": "2.0" 78 | } -------------------------------------------------------------------------------- /demo/plain_post/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/plain_post/__init__.py -------------------------------------------------------------------------------- /demo/plain_post/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/plain_post/ops/__init__.py -------------------------------------------------------------------------------- /demo/plain_post/ops/hello.py: -------------------------------------------------------------------------------- 1 | def post_it(name): 2 | return { 3 | 'post': name 4 | } 5 | 6 | 7 | def more_than_8(name): 8 | if len(name) < 8: 9 | return False, 'less than 8' 10 | return True 11 | -------------------------------------------------------------------------------- /demo/plain_post/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/plain_post/static') 4 | f.swagger('demo/plain_post/spec.yml', ui=True, ui_language='zh-cn', theme='responsive') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/plain_post/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - application/json 9 | basePath: "/v1" 10 | paths: 11 | '/hello': 12 | post: 13 | consumes: 14 | - plain/text 15 | tags: [Method] 16 | operationId: demo.plain_post.ops.hello.post_it 17 | summary: 测试post请求 18 | parameters: 19 | - name: name 20 | in: body 21 | validationId: demo.plain_post.ops.hello.more_than_8 22 | schema: 23 | type: string 24 | default: 'hahahaha' 25 | responses: 26 | 200: 27 | description: Return response 28 | -------------------------------------------------------------------------------- /demo/plain_post/static/spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API", 8 | "version": "0.1" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "post": { 13 | "consumes": [ 14 | "plain/text" 15 | ], 16 | "operationId": "demo.plain_post.ops.hello.post_it", 17 | "parameters": [ 18 | { 19 | "in": "body", 20 | "name": "name", 21 | "schema": { 22 | "default": "hahahaha", 23 | "type": "string" 24 | } 25 | } 26 | ], 27 | "responses": { 28 | "200": { 29 | "description": "Return response" 30 | } 31 | }, 32 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 33 | "tags": [ 34 | "Method" 35 | ] 36 | } 37 | } 38 | }, 39 | "produces": [ 40 | "application/json" 41 | ], 42 | "swagger": "2.0" 43 | } -------------------------------------------------------------------------------- /demo/simple/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/simple/__init__.py -------------------------------------------------------------------------------- /demo/simple/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/simple/ops/__init__.py -------------------------------------------------------------------------------- /demo/simple/ops/hello.py: -------------------------------------------------------------------------------- 1 | from falsy.jlog.jlog import JLog 2 | 3 | log = JLog().bind() 4 | 5 | def get_it(name): 6 | log.debug('get it') 7 | return { 8 | 'get': name 9 | } 10 | 11 | 12 | def post_it(name): 13 | log.debug('post it') 14 | return { 15 | 'post': name 16 | } 17 | 18 | 19 | def delete_it(name): 20 | return { 21 | 'delete': name 22 | } 23 | 24 | 25 | def put_it(name): 26 | return { 27 | 'put': name 28 | } 29 | 30 | 31 | def patch_it(name): 32 | return { 33 | 'patch': name 34 | } 35 | -------------------------------------------------------------------------------- /demo/simple/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/simple/static',log_config={'highlights':['falsy']}) 4 | f.swagger('demo/simple/spec.yml', ui=True, ui_language='zh-cn', theme='impress') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/simple/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | contact: 6 | name: 'jesse' 7 | basePath: "/v1" 8 | tags: 9 | - name: GET 10 | description: GET 11 | - name: POST 12 | description: POST 13 | paths: 14 | '/hello': 15 | get: 16 | tags: [GET] 17 | operationId: demo.simple.ops.hello.get_it 18 | summary: 测试get请求 19 | parameters: 20 | - name: name 21 | in: query 22 | type: string 23 | default: 'john' 24 | responses: 25 | 200: 26 | description: Return response 27 | consumes: 28 | - application/json 29 | produces: 30 | - text/html 31 | - application/json 32 | post: 33 | tags: [POST] 34 | operationId: demo.simple.ops.hello.post_it 35 | summary: 测试post请求 36 | parameters: 37 | - name: name 38 | in: body 39 | schema: 40 | type: object 41 | properties: 42 | name: 43 | type: string 44 | default: 'john' 45 | responses: 46 | 200: 47 | description: Return response 48 | consumes: 49 | - application/json 50 | produces: 51 | - text/html 52 | - application/json 53 | delete: 54 | tags: [DELETE] 55 | operationId: demo.simple.ops.hello.delete_it 56 | summary: 测试delete请求 57 | parameters: 58 | - name: name 59 | in: query 60 | type: string 61 | default: 'john' 62 | responses: 63 | 200: 64 | description: Return response 65 | consumes: 66 | - application/json 67 | produces: 68 | - text/html 69 | - application/json 70 | put: 71 | tags: [PUT] 72 | operationId: demo.simple.ops.hello.put_it 73 | summary: 测试put请求 74 | parameters: 75 | - name: name 76 | in: query 77 | type: string 78 | default: 'john' 79 | responses: 80 | 200: 81 | description: Return response 82 | consumes: 83 | - application/json 84 | produces: 85 | - text/html 86 | - application/json 87 | patch: 88 | tags: [PATCH] 89 | operationId: demo.simple.ops.hello.patch_it 90 | summary: 测试patch请求 91 | parameters: 92 | - name: name 93 | in: query 94 | type: string 95 | default: 'john' 96 | responses: 97 | 200: 98 | description: Return response 99 | consumes: 100 | - application/json 101 | produces: 102 | - text/html 103 | - application/json 104 | -------------------------------------------------------------------------------- /demo/simple/static/spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "info": { 7 | "title": "FALSY SIMPLE DEMO API", 8 | "version": "0.1" 9 | }, 10 | "paths": { 11 | "/hello": { 12 | "delete": { 13 | "operationId": "demo.simple.ops.hello.delete_it", 14 | "parameters": [ 15 | { 16 | "default": "john", 17 | "in": "query", 18 | "name": "name", 19 | "type": "string" 20 | } 21 | ], 22 | "responses": { 23 | "200": { 24 | "description": "Return response" 25 | } 26 | }, 27 | "summary": "\u6d4b\u8bd5delete\u8bf7\u6c42", 28 | "tags": [ 29 | "Method" 30 | ] 31 | }, 32 | "get": { 33 | "operationId": "demo.simple.ops.hello.get_it", 34 | "parameters": [ 35 | { 36 | "default": "john", 37 | "in": "query", 38 | "name": "name", 39 | "type": "string" 40 | } 41 | ], 42 | "responses": { 43 | "200": { 44 | "description": "Return response" 45 | } 46 | }, 47 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 48 | "tags": [ 49 | "Method" 50 | ] 51 | }, 52 | "patch": { 53 | "operationId": "demo.simple.ops.hello.patch_it", 54 | "parameters": [ 55 | { 56 | "default": "john", 57 | "in": "query", 58 | "name": "name", 59 | "type": "string" 60 | } 61 | ], 62 | "responses": { 63 | "200": { 64 | "description": "Return response" 65 | } 66 | }, 67 | "summary": "\u6d4b\u8bd5patch\u8bf7\u6c42", 68 | "tags": [ 69 | "Method" 70 | ] 71 | }, 72 | "post": { 73 | "operationId": "demo.simple.ops.hello.post_it", 74 | "parameters": [ 75 | { 76 | "default": "john", 77 | "in": "query", 78 | "name": "name", 79 | "type": "string" 80 | } 81 | ], 82 | "responses": { 83 | "200": { 84 | "description": "Return response" 85 | } 86 | }, 87 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 88 | "tags": [ 89 | "Method" 90 | ] 91 | }, 92 | "put": { 93 | "operationId": "demo.simple.ops.hello.put_it", 94 | "parameters": [ 95 | { 96 | "default": "john", 97 | "in": "query", 98 | "name": "name", 99 | "type": "string" 100 | } 101 | ], 102 | "responses": { 103 | "200": { 104 | "description": "Return response" 105 | } 106 | }, 107 | "summary": "\u6d4b\u8bd5put\u8bf7\u6c42", 108 | "tags": [ 109 | "Method" 110 | ] 111 | } 112 | } 113 | }, 114 | "produces": [ 115 | "application/json" 116 | ], 117 | "swagger": "2.0" 118 | } -------------------------------------------------------------------------------- /demo/split/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/split/__init__.py -------------------------------------------------------------------------------- /demo/split/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/split/ops/__init__.py -------------------------------------------------------------------------------- /demo/split/ops/hello.py: -------------------------------------------------------------------------------- 1 | def get_it(name): 2 | return { 3 | 'get': name 4 | } 5 | 6 | 7 | def post_it(name): 8 | return { 9 | 'post': name 10 | } 11 | 12 | 13 | def delete_it(name): 14 | return { 15 | 'delete': name 16 | } 17 | 18 | 19 | def put_it(name): 20 | return { 21 | 'put': name 22 | } 23 | 24 | 25 | def patch_it(name): 26 | return { 27 | 'patch': name 28 | } 29 | -------------------------------------------------------------------------------- /demo/split/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/simple/static') 4 | f.swagger('demo/split/ymls/spec.yml', ui=True, ui_language='zh-cn', theme='responsive') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/split/ymls/get.yml: -------------------------------------------------------------------------------- 1 | tags: [Method] 2 | operationId: demo.simple.ops.hello.get_it 3 | summary: 测试get请求 4 | parameters: 5 | - name: name 6 | in: query 7 | type: string 8 | default: 'john' 9 | responses: 10 | 200: 11 | description: Return persons 12 | -------------------------------------------------------------------------------- /demo/split/ymls/post.yml: -------------------------------------------------------------------------------- 1 | tags: [Method] 2 | operationId: demo.simple.ops.hello.post_it 3 | summary: 测试post请求 4 | parameters: 5 | - name: name 6 | in: query 7 | type: string 8 | default: 'john' 9 | responses: 10 | 200: 11 | description: Return persons 12 | -------------------------------------------------------------------------------- /demo/split/ymls/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - application/json 9 | basePath: "/v1" 10 | paths: 11 | '/hello': 12 | get: !include ./get.yml 13 | post: !include ./post.yml 14 | -------------------------------------------------------------------------------- /demo/valid/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/valid/__init__.py -------------------------------------------------------------------------------- /demo/valid/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/valid/ops/__init__.py -------------------------------------------------------------------------------- /demo/valid/ops/hello.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | import falcon 4 | 5 | 6 | def validate_post_name_starts_with_john(payload): 7 | name = payload['name'] 8 | if not name.startswith('john'): 9 | return False, 'not starts with john' 10 | return True 11 | 12 | 13 | def validate_post_name_more_than_8(payload): 14 | name = payload['name'] 15 | if len(name) < 8: 16 | return False, 'less than 8' 17 | return True 18 | 19 | 20 | def validate_get_more_than_6(name): 21 | if len(name) < 6: 22 | return False, 'less than 6' 23 | return True 24 | 25 | 26 | def validate_get_required(name): 27 | if name is None: 28 | return False 29 | return True 30 | 31 | 32 | def get_it_required(name): 33 | raise Exception('name') 34 | return { 35 | 'get': name 36 | } 37 | 38 | 39 | def get_it(name): 40 | return { 41 | 'get': name 42 | } 43 | 44 | 45 | def before_get_it2(req, resp, name, id): 46 | if len(name) < 6: 47 | raise falcon.HTTPInvalidParam('invalid param', name + ':' + 'name less than 6') 48 | if int(id) < 10: 49 | raise falcon.HTTPInvalidParam('invalid param', name + ':' + 'id less than 10') 50 | 51 | 52 | def get_it2(name, id): 53 | return { 54 | 'hello1': name, 55 | 'hello2': id 56 | } 57 | 58 | 59 | def post_it(payload): 60 | return { 61 | 'post': payload 62 | } 63 | 64 | 65 | def delete_it(name): 66 | return { 67 | 'delete': name 68 | } 69 | 70 | 71 | def put_it(name): 72 | return { 73 | 'put': name 74 | } 75 | 76 | 77 | def patch_it(name): 78 | return { 79 | 'patch': name 80 | } 81 | -------------------------------------------------------------------------------- /demo/valid/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_path='test', static_dir='demo/valid/static') 4 | f.swagger('demo/valid/spec.yml', ui=True, ui_language='zh-cn', theme='impress') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/valid/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - application/json 9 | basePath: "/v1" 10 | paths: 11 | '/hello_required_backend': 12 | get: 13 | tags: [All] 14 | operationId: demo.valid.ops.hello.get_it_required 15 | summary: 测试get请求 16 | parameters: 17 | - name: name 18 | in: query 19 | type: string 20 | default: 'john' 21 | validationId: demo.valid.ops.hello.validate_get_required 22 | responses: 23 | 200: 24 | description: Return persons 25 | '/hello_required': 26 | get: 27 | tags: [All] 28 | operationId: demo.valid.ops.hello.get_it_required 29 | summary: 测试get请求 30 | parameters: 31 | - name: name 32 | in: query 33 | type: string 34 | default: 'john' 35 | required: true 36 | responses: 37 | 200: 38 | description: Return persons 39 | '/hello_in_query': 40 | get: 41 | tags: [All] 42 | operationId: demo.valid.ops.hello.get_it 43 | summary: 测试get请求 44 | description: name需要大于等于6字符 45 | parameters: 46 | - name: name 47 | validationId: demo.valid.ops.hello.validate_get_more_than_6 48 | in: query 49 | type: string 50 | default: 'john' 51 | required: true 52 | responses: 53 | 200: 54 | description: Return persons 55 | '/hello_in_path/{name}': 56 | get: 57 | tags: [All] 58 | operationId: demo.valid.ops.hello.get_it 59 | summary: 测试get请求 60 | description: name需要大于等于6字符 61 | parameters: 62 | - name: name 63 | validationId: demo.valid.ops.hello.validate_get_more_than_6 64 | in: path 65 | type: string 66 | default: 'john' 67 | required: true 68 | responses: 69 | 200: 70 | description: Return persons 71 | '/hello': 72 | get: 73 | tags: [All] 74 | operationId: demo.valid.ops.hello.get_it 75 | summary: 测试get请求 76 | description: name需要大于等于6字符 77 | parameters: 78 | - name: name 79 | validationId: demo.valid.ops.hello.validate_get_more_than_6 80 | in: query 81 | type: string 82 | default: 'john' 83 | required: true 84 | responses: 85 | 200: 86 | description: Return persons 87 | post: 88 | tags: [All, Post] 89 | operationId: demo.valid.ops.hello.post_it 90 | validationId: demo.valid.ops.hello.validate_post_name_starts_with_john 91 | summary: 测试post请求 92 | parameters: 93 | - name: payload 94 | in: body 95 | validationId: demo.valid.ops.hello.validate_post_name_more_than_8 96 | schema: 97 | type: object 98 | properties: 99 | name: 100 | type: string 101 | default: 'john' 102 | responses: 103 | 200: 104 | description: Return persons 105 | '/hello_2': 106 | get: 107 | tags: [All] 108 | beforeId: demo.valid.ops.hello.before_get_it2 109 | operationId: demo.valid.ops.hello.get_it2 110 | summary: 测试get请求 111 | description: name需要大于等于6字符 112 | parameters: 113 | - name: name 114 | in: query 115 | type: string 116 | default: 'john' 117 | required: true 118 | - name: id 119 | in: query 120 | type: string 121 | default: 'john' 122 | required: true 123 | responses: 124 | 200: 125 | description: Return persons 126 | -------------------------------------------------------------------------------- /demo/webargs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/webargs/__init__.py -------------------------------------------------------------------------------- /demo/webargs/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/webargs/ops/__init__.py -------------------------------------------------------------------------------- /demo/webargs/ops/hello.py: -------------------------------------------------------------------------------- 1 | from webargs import fields 2 | from webargs.falconparser import parser, HTTPError 3 | from falsy.jlog.jlog import JLog 4 | 5 | log = JLog().bind() 6 | 7 | hello_args = { 8 | 'name': fields.Str(validate=lambda p: len(p) >= 6)#, location='query') 9 | } 10 | 11 | 12 | def before_get_it(req, resp, name): 13 | log = JLog().bind() 14 | try: 15 | parsed_args = parser.parse(hello_args, req=req) 16 | except HTTPError as e: 17 | log.error_trace(str(e.errors)) 18 | raise Exception(e.errors) 19 | 20 | 21 | def get_it(name): 22 | log.debug('get it') 23 | return { 24 | 'get': name 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /demo/webargs/serve.py: -------------------------------------------------------------------------------- 1 | from falsy.falsy import FALSY 2 | 3 | f = FALSY(static_dir='demo/webargs/static') 4 | f.swagger('demo/webargs/spec.yml', ui=True, ui_language='zh-cn', theme='impress') 5 | api = f.api 6 | -------------------------------------------------------------------------------- /demo/webargs/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API 4 | version: "0.1" 5 | consumes: 6 | - application/json 7 | produces: 8 | - text/html 9 | - application/json 10 | basePath: "/v1" 11 | paths: 12 | '/hello': 13 | get: 14 | tags: [GET] 15 | operationId: demo.webargs.ops.hello.get_it 16 | beforeId: demo.webargs.ops.hello.before_get_it 17 | summary: 测试get请求 18 | parameters: 19 | - name: name 20 | in: query 21 | type: string 22 | default: 'john' 23 | responses: 24 | 200: 25 | description: Return response 26 | -------------------------------------------------------------------------------- /demo/with_wsgi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/with_wsgi/__init__.py -------------------------------------------------------------------------------- /demo/with_wsgi/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/demo/with_wsgi/ops/__init__.py -------------------------------------------------------------------------------- /demo/with_wsgi/ops/flask.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | 3 | PRE_FLASK = 'flask' 4 | 5 | 6 | def pre_flask(route): 7 | return '/' + PRE_FLASK + '/' + route.lstrip('/') 8 | 9 | 10 | 11 | flask_app = Flask(__name__) 12 | 13 | 14 | @flask_app.route(pre_flask('/test')) 15 | def hello_flask(): 16 | return "

Hello Flask!

" 17 | -------------------------------------------------------------------------------- /demo/with_wsgi/ops/hello.py: -------------------------------------------------------------------------------- 1 | import falcon 2 | 3 | 4 | def get_it(): 5 | return "

Hello Falsy!

", falcon.HTTP_200 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demo/with_wsgi/ops/tornado.py: -------------------------------------------------------------------------------- 1 | import tornado.web 2 | import tornado.wsgi 3 | 4 | 5 | class TornadoHandler(tornado.web.RequestHandler): 6 | def get(self): 7 | self.write("

Hello Tornado!

") 8 | PRE_TORNADO = 'tornado' 9 | 10 | 11 | def pre_tornado(route): 12 | return '/' + PRE_TORNADO + '/' + route.lstrip('/') 13 | 14 | application = tornado.web.Application([ 15 | (pre_tornado('test'), TornadoHandler), 16 | ]) 17 | tornado_app = tornado.wsgi.WSGIAdapter(application) 18 | -------------------------------------------------------------------------------- /demo/with_wsgi/serve.py: -------------------------------------------------------------------------------- 1 | from demo.with_wsgi.ops.flask import flask_app, PRE_FLASK 2 | from demo.with_wsgi.ops.tornado import tornado_app, PRE_TORNADO 3 | from falsy.falsy import FALSY 4 | 5 | f = FALSY(static_dir='demo/with_wsgi/static') \ 6 | .swagger('demo/with_wsgi/spec.yml', ui=True, ui_language='zh-cn', theme='normal') \ 7 | .wsgi(flask_app, PRE_FLASK) \ 8 | .wsgi(tornado_app, PRE_TORNADO) 9 | api = f.api 10 | 11 | 12 | -------------------------------------------------------------------------------- /demo/with_wsgi/spec.yml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | title: FALSY SIMPLE DEMO API v1 4 | version: "0.3" 5 | consumes: 6 | - application/json 7 | produces: 8 | - text/html 9 | basePath: "/v1" 10 | enableCookies: true 11 | paths: 12 | '/hello': 13 | get: 14 | tags: [Method] 15 | operationId: demo.with_wsgi.ops.hello.get_it 16 | summary: 测试get请求 17 | responses: 18 | 200: 19 | description: Return response 20 | -------------------------------------------------------------------------------- /demo/with_wsgi/static/demo_with_flask_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "enableCookies": true, 7 | "info": { 8 | "title": "FALSY SIMPLE DEMO API v1", 9 | "version": "0.3" 10 | }, 11 | "paths": { 12 | "/hello": { 13 | "get": { 14 | "parameters": [ 15 | { 16 | "default": "jesse", 17 | "in": "query", 18 | "name": "name", 19 | "type": "string" 20 | } 21 | ], 22 | "responses": { 23 | "200": { 24 | "description": "Return response" 25 | } 26 | }, 27 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 28 | "tags": [ 29 | "Method" 30 | ] 31 | } 32 | } 33 | }, 34 | "produces": [ 35 | "application/json" 36 | ], 37 | "swagger": "2.0" 38 | } -------------------------------------------------------------------------------- /falsy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy.gif -------------------------------------------------------------------------------- /falsy/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /falsy/jlog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/jlog/__init__.py -------------------------------------------------------------------------------- /falsy/jlog/filters.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from falsy.termcc.termcc import magenta, rmagenta, cc 4 | 5 | 6 | class TraceFilter(logging.Filter): 7 | def filter(self, record): 8 | if 'trace' not in dir(record): 9 | record.trace = '' 10 | else: 11 | record.trace = '\n\t' + record.trace 12 | return True 13 | 14 | 15 | class HighlightFilter(logging.Filter): 16 | def __init__(self, highlights=None): 17 | self.highlights = highlights 18 | 19 | def filter(self, record): 20 | record.high = '' 21 | if self.highlights is None: 22 | return True 23 | for e in self.highlights: 24 | if e in record.msg: 25 | record.high = '\n\t' + \ 26 | magenta() + 'highlight' + rmagenta() + ': ' + \ 27 | record.msg.replace(e, cc(e, fore='yellow', back='red')) 28 | return True 29 | 30 | -------------------------------------------------------------------------------- /falsy/jlog/formatters.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | import collections 4 | 5 | from falsy.termcc.termcc import fore, back, style, reset, rastyle, rred, ritalic, reverse, rafore, raback 6 | 7 | 8 | class ColoredRecord(object): 9 | class __dict(collections.defaultdict): 10 | def __missing__(self, name): 11 | try: 12 | return parse_colors(name) 13 | except Exception: 14 | raise KeyError("{} is not a valid record attribute " 15 | "or color sequence".format(name)) 16 | 17 | def __init__(self, record): 18 | self.__dict__ = self.__dict() 19 | self.__dict__.update(record.__dict__) 20 | self.__record = record 21 | 22 | def __getattr__(self, name): 23 | return getattr(self.__record, name) 24 | 25 | 26 | codes = { 27 | 'black': fore('black'), 28 | 'red': fore('red'), 29 | 'green': fore('green'), 30 | 'yellow': fore('yellow'), 31 | 'blue': fore('blue'), 32 | 'magenta': fore('magenta'), 33 | 'cyan': fore('cyan'), 34 | 'lgray': fore('lightgray'), 35 | 'gray': fore('darkgray'), 36 | 'lred': fore('lightred'), 37 | 'lgreen': fore('lightgreen'), 38 | 'lyellow': fore('lightyellow'), 39 | 'lblue': fore('lightblue'), 40 | 'lmagenta': fore('lightmagenta'), 41 | 'lcyan': fore('lightcyan'), 42 | 'white': fore('white'), 43 | 44 | 'black_': back('black'), 45 | 'red_': back('red'), 46 | 'green_': back('green'), 47 | 'yellow_': back('yellow'), 48 | 'blue_': back('blue'), 49 | 'magenta_': back('magenta'), 50 | 'cyan_': back('cyan'), 51 | 'lgray_': back('lightgray'), 52 | 'gray_': back('darkgray'), 53 | 'lred_': back('lightred'), 54 | 'lgreen_': back('lightgreen'), 55 | 'lyellow_': back('lightyellow'), 56 | 'lblue_': back('lightblue'), 57 | 'lmagenta_': back('lightmagenta'), 58 | 'lcyan_': back('lightcyan'), 59 | 'white_': back('white'), 60 | 61 | 'bold': style('bold'), 62 | 'dim': style('dim'), 63 | 'italic': style('italic'), 64 | 'underlined': style('underlined'), 65 | 'blink': style('blink'), 66 | 'reverse': style('reverse'), 67 | 'hidden': style('hidden'), 68 | 69 | 'reset': reset(), 70 | 'rstyle': rastyle(), 71 | 'rafore': rafore(), 72 | 'raback': raback(), 73 | } 74 | 75 | 76 | def get_color_code(e): 77 | if '0' <= e[0] <= '9': 78 | if len(e) > 1: 79 | if e[-1] == '_': 80 | return back(int(e[:-1])) 81 | else: 82 | return fore(int(e)) 83 | else: 84 | return fore(e) 85 | return codes[e] 86 | 87 | 88 | def parse_colors(sequence): 89 | a = ''.join(get_color_code(e) for e in sequence.split(',') if e) 90 | return a 91 | 92 | 93 | class JLogColoredFormatter(logging.Formatter): 94 | def __init__(self, fmt=None, datefmt=None, style='%', 95 | log_colors=None, reset=True): 96 | if fmt is None: 97 | default_formats = { 98 | '%': '%(log_color)s%(levelname)s:%(name)s:%(message)s', 99 | '{': '{log_color}{levelname}:{name}:{message}', 100 | '$': '${log_color}${levelname}:${name}:${message}' 101 | } 102 | fmt = default_formats[style] 103 | 104 | super().__init__(fmt, datefmt, style) 105 | default_log_colors = { 106 | 'DEBUG': 'white', 107 | 'INFO': 'green', 108 | 'WARNING': 'yellow', 109 | 'ERROR': 'red', 110 | 'CRITICAL': 'red', 111 | } 112 | 113 | self.log_colors = ( 114 | log_colors if log_colors is not None else default_log_colors) 115 | self.reset = reset 116 | 117 | def color(self, log_colors, level_name): 118 | return parse_colors(log_colors.get(level_name, "")) 119 | 120 | def format(self, record): 121 | record = ColoredRecord(record) 122 | record.log_color = self.color(self.log_colors, record.levelname) 123 | 124 | message = super().format(record) 125 | 126 | if self.reset and not message.endswith(codes['reset']): 127 | message += codes['reset'] 128 | 129 | return message 130 | -------------------------------------------------------------------------------- /falsy/jlog/test.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import traceback 3 | 4 | import sys 5 | from falsy.jlog import LOG_CONFIG 6 | from falsy.jlog.jlog import JLog 7 | 8 | # logging.config.dictConfig(LOG_CONFIG) 9 | from falsy.termcc.termcc import blue, yellow, red, cyan, bold 10 | 11 | 12 | # def print_format_table(): 13 | # """ 14 | # prints table of formatted text format options 15 | # """ 16 | # for style in range(8): 17 | # for fg in range(30, 38): 18 | # s1 = '' 19 | # for bg in range(40, 48): 20 | # format = ';'.join([str(style), str(fg), str(bg)]) 21 | # s1 += '\x1b[%sm %s \x1b[0m' % (format, format) 22 | # print(s1) 23 | # print('\n') 24 | 25 | 26 | def test(): 27 | raise Exception('haha') 28 | 29 | def test1(): 30 | test() 31 | # raise Exception('haha') 32 | 33 | if __name__ == '__main__': 34 | log = JLog().setup().bind() 35 | log.debug('hehe') 36 | log.info('hehe') 37 | log.error('noshow') 38 | log.critical('hehe') 39 | try: 40 | test1() 41 | except Exception as e: 42 | log.error_trace('error trace') 43 | log.critical_trace('critical trace') 44 | -------------------------------------------------------------------------------- /falsy/loader/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/loader/__init__.py -------------------------------------------------------------------------------- /falsy/loader/func.py: -------------------------------------------------------------------------------- 1 | import functools 2 | import importlib 3 | 4 | func_map = {} 5 | 6 | 7 | def load(function_name): 8 | if not function_name: 9 | return None 10 | 11 | if function_name in func_map.keys(): 12 | return func_map[function_name] 13 | 14 | module_name, attr_path = function_name.rsplit('.', 1) 15 | module = None 16 | last_import_error = None 17 | 18 | while not module: 19 | 20 | try: 21 | module = importlib.import_module(module_name) 22 | except ImportError as import_error: 23 | last_import_error = import_error 24 | if '.' in module_name: 25 | module_name, attr_path1 = module_name.rsplit('.', 1) 26 | attr_path = '{0}.{1}'.format(attr_path1, attr_path) 27 | else: 28 | raise 29 | try: 30 | function = deep_getattr(module, attr_path) 31 | except AttributeError: 32 | if last_import_error: 33 | raise last_import_error 34 | else: 35 | raise 36 | func_map[str(function_name)] = function 37 | return function 38 | 39 | 40 | def deep_getattr(obj, attr): 41 | return functools.reduce(getattr, attr.split('.'), obj) 42 | -------------------------------------------------------------------------------- /falsy/loader/task.py: -------------------------------------------------------------------------------- 1 | from falsy.loader import func 2 | 3 | try: 4 | from celery import chain, chord, group 5 | except Exception as e: 6 | raise Exception('celery import failed') 7 | 8 | 9 | def load(id, args, error_handler=None): 10 | if args and error_handler: 11 | return func.load(id).s(args).on_error(func.load(error_handler).s()) 12 | if args and not error_handler: 13 | return func.load(id).s(args) 14 | if not args and error_handler: 15 | return func.load(id).s().on_error(func.load(error_handler).s()) 16 | return func.load(id).s() 17 | 18 | 19 | def loads(payload): 20 | if payload.get('type') != 'normal': 21 | raise Exception('celery task loader only support normal mode') 22 | tasks = payload.get('tasks', []) 23 | cts = [] 24 | for task in tasks: 25 | ops = [load(id, task.get('args'), task.get('on_error')) if i == 0 else load(id, None, task.get('on_error')) for 26 | i, id in enumerate(task['ids'])] 27 | cts.append(chain(ops)) 28 | callback = payload.get('callback') 29 | if callback: 30 | return chord(header=group(cts), body=func.load(callback).s()) 31 | return group(cts) 32 | -------------------------------------------------------------------------------- /falsy/loader/yaml.py: -------------------------------------------------------------------------------- 1 | import os 2 | # import pprint 3 | 4 | import yaml 5 | 6 | 7 | class LoaderMeta(type): 8 | 9 | def __new__(metacls, __name__, __bases__, __dict__): 10 | """Add include constructer to class.""" 11 | 12 | # register the include constructor on the class 13 | cls = super().__new__(metacls, __name__, __bases__, __dict__) 14 | cls.add_constructor('!include', cls.construct_include) 15 | cls.add_constructor('include!', cls.construct_include) 16 | 17 | return cls 18 | 19 | 20 | class Loader(yaml.Loader, metaclass=LoaderMeta): 21 | """YAML Loader with `!include` constructor.""" 22 | 23 | def __init__(self, stream): 24 | """Initialise Loader.""" 25 | 26 | try: 27 | self._root = os.path.split(stream.name)[0] 28 | except AttributeError: 29 | self._root = os.path.curdir 30 | 31 | super().__init__(stream) 32 | 33 | def construct_include(self, node): 34 | """Include file referenced at node.""" 35 | 36 | filename = os.path.abspath(os.path.join( 37 | self._root, self.construct_scalar(node) 38 | )) 39 | filename = os.path.join(self._root, self.construct_scalar(node)) 40 | 41 | extension = os.path.splitext(filename)[1].lstrip('.') 42 | 43 | with open(filename, 'r') as f: 44 | if extension in ('yaml', 'yml'): 45 | return yaml.load(f, Loader) 46 | else: 47 | return ''.join(f.readlines()) 48 | 49 | 50 | def load(filename): 51 | with open(filename, 'r') as f: 52 | data = yaml.load(f, Loader) 53 | # pp = pprint.PrettyPrinter(indent=4) 54 | # pp.pprint(data) 55 | return data 56 | -------------------------------------------------------------------------------- /falsy/netboy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/netboy/__init__.py -------------------------------------------------------------------------------- /falsy/netboy/curl_loop.py: -------------------------------------------------------------------------------- 1 | import asyncio as aio 2 | import atexit 3 | import pycurl 4 | 5 | from falsy.loader.func import load 6 | from falsy.netboy.curl_result import curl_result 7 | 8 | 9 | class CurlLoop: 10 | class CurlException(Exception): 11 | def __init__(self, code, desc, data): 12 | self.code = code 13 | self.desc = desc 14 | self.data = data 15 | 16 | _multi = pycurl.CurlMulti() 17 | _multi.setopt(pycurl.M_PIPELINING, 1) 18 | atexit.register(_multi.close) 19 | _futures = {} 20 | 21 | @classmethod 22 | async def handler_ready(cls, c): 23 | cls._futures[c] = aio.Future() 24 | cls._multi.add_handle(c) 25 | try: 26 | try: 27 | curl_ret = await cls._futures[c] 28 | except CurlLoop.CurlException as e: 29 | return { 30 | 'url': c._raw_url, 31 | 'id': c._raw_id, 32 | 'payload': c._raw_payload, 33 | 'spider': 'pycurl', 34 | 'state': 'error', 35 | 'error_code': e.code, 36 | 'error_desc': e.desc, 37 | } 38 | except Exception as e: 39 | return { 40 | 'url': c._raw_url, 41 | 'id': c._raw_id, 42 | 'payload': c._raw_payload, 43 | 'spider': 'pycurl', 44 | 'state': 'critical', 45 | 'error_code': -1, 46 | 'error_desc': "{} - {}".format(type(e), str(e)), 47 | } 48 | return curl_ret 49 | finally: 50 | cls._multi.remove_handle(c) 51 | 52 | @classmethod 53 | def perform(cls): 54 | if cls._futures: 55 | while True: 56 | status, num_active = cls._multi.perform() 57 | if status != pycurl.E_CALL_MULTI_PERFORM: 58 | break 59 | while True: 60 | num_ready, success, fail = cls._multi.info_read() 61 | for c in success: 62 | cc = cls._futures.pop(c) 63 | result = curl_result(c) 64 | result['url'] = c._raw_url 65 | result['id'] = c._raw_id 66 | result['state'] = 'normal' 67 | result['spider'] = 'pycurl' 68 | result['payload'] = payload = c._raw_payload 69 | 70 | # post_func = payload.get('post_func') 71 | # if type(post_func) == str: 72 | # post_func = load(post_func) 73 | # if post_func: 74 | # result = post_func(payload, result) 75 | 76 | cc.set_result(result) 77 | for c, err_num, err_msg in fail: 78 | print('error:', err_num, err_msg, c.getinfo(pycurl.EFFECTIVE_URL)) 79 | result = curl_result(c) 80 | 81 | result['url'] = c._raw_url 82 | result['id'] = c._raw_id 83 | result['state'] = 'error' 84 | result['spider'] = 'pycurl' 85 | result['error_code'] = err_num 86 | result['error_desc'] = err_msg 87 | 88 | result['payload'] = payload = c._raw_payload 89 | 90 | # post_func = payload.get('post_func') 91 | # if type(post_func) == str: 92 | # post_func = load(post_func) 93 | # if post_func: 94 | # result2 = post_func(payload, result) 95 | # if type(result2) is dict and len(result2) >= len(result): 96 | # result = result2 97 | cls._futures.pop(c).set_exception(CurlLoop.CurlException(code=err_num, desc=err_msg, data=result)) 98 | if num_ready == 0: 99 | break 100 | 101 | 102 | async def curl_loop(): 103 | while True: 104 | await aio.sleep(0) 105 | CurlLoop.perform() 106 | -------------------------------------------------------------------------------- /falsy/netboy/curl_result.py: -------------------------------------------------------------------------------- 1 | import pycurl 2 | def curl_result(c): 3 | effective_url = c.getinfo(pycurl.EFFECTIVE_URL) 4 | primary_ip = c.getinfo(pycurl.PRIMARY_IP) 5 | primary_port = c.getinfo(pycurl.PRIMARY_PORT) 6 | local_ip = c.getinfo(pycurl.LOCAL_IP) 7 | local_port = c.getinfo(pycurl.LOCAL_PORT) 8 | speed_download = c.getinfo(pycurl.SPEED_DOWNLOAD) 9 | size_download = c.getinfo(pycurl.SIZE_DOWNLOAD) 10 | redirect_time = c.getinfo(pycurl.REDIRECT_TIME) 11 | redirect_count = c.getinfo(pycurl.REDIRECT_COUNT) 12 | redirect_url = c.getinfo(pycurl.REDIRECT_URL) 13 | http_code = c.getinfo(pycurl.HTTP_CODE) 14 | response_code = c.getinfo(pycurl.RESPONSE_CODE) 15 | total_time = c.getinfo(pycurl.TOTAL_TIME) 16 | content_type = c.getinfo(pycurl.CONTENT_TYPE) 17 | namelookup_time = c.getinfo(pycurl.NAMELOOKUP_TIME) 18 | info_filetime = c.getinfo(pycurl.INFO_FILETIME) 19 | http_connectcode = c.getinfo(pycurl.HTTP_CONNECTCODE) 20 | starttransfer_time = c.getinfo(pycurl.STARTTRANSFER_TIME) 21 | pretransfer_time = c.getinfo(pycurl.PRETRANSFER_TIME) 22 | header_size = c.getinfo(pycurl.HEADER_SIZE) 23 | request_size = c.getinfo(pycurl.REQUEST_SIZE) 24 | ssl_verifyresult = c.getinfo(pycurl.SSL_VERIFYRESULT) 25 | num_connects = c.getinfo(pycurl.NUM_CONNECTS) 26 | 27 | return { 28 | 'effective_url': effective_url, 29 | 'primary_ip': primary_ip, 30 | 'primary_port': primary_port, 31 | 'local_ip': local_ip, 32 | 'local_port': local_port, 33 | 'speed_download': speed_download, 34 | 'size_download': size_download, 35 | 'redirect_time': redirect_time, 36 | 'redirect_count': redirect_count, 37 | 'redirect_url': redirect_url, 38 | 'http_code': http_code, 39 | 'response_code': response_code, 40 | 'total_time': total_time, 41 | 'content_type': content_type, 42 | 'namelookup_time': namelookup_time, 43 | 'info_filetime': info_filetime, 44 | 'http_connectcode': http_connectcode, 45 | 'starttransfer_time': starttransfer_time, 46 | 'pretransfer_time': pretransfer_time, 47 | 'header_size': header_size, 48 | 'request_size': request_size, 49 | 'ssl_verifyresult': ssl_verifyresult, 50 | 'num_connects': num_connects, 51 | # 'proxy_ssl_verifyresult': proxy_ssl_verifyresult, 52 | # 'app_connecttime': app_connecttime, 53 | 54 | } 55 | -------------------------------------------------------------------------------- /falsy/netboy/fetch.py: -------------------------------------------------------------------------------- 1 | 2 | from falsy.netboy.request import get_request, post_request 3 | import asyncio as aio 4 | 5 | 6 | async def get_boy(payload): 7 | targets = [] 8 | for p in payload: 9 | targets.append(get_request(p)) 10 | res = await aio.gather( 11 | *targets, return_exceptions=True 12 | ) 13 | return res 14 | 15 | async def post_boy(payload): 16 | targets = [] 17 | for p in payload: 18 | targets.append(post_request(p)) 19 | res = await aio.gather( 20 | *targets, return_exceptions=True 21 | ) 22 | return res 23 | 24 | async def net_boy(payload, share=None): 25 | targets = [] 26 | for p in payload: 27 | if p.get('postfields'): 28 | targets.append(post_request(p, share)) 29 | else: 30 | targets.append(get_request(p, share)) 31 | res = await aio.gather( 32 | *targets, return_exceptions=True 33 | ) 34 | return res 35 | -------------------------------------------------------------------------------- /falsy/netboy/netboy.py: -------------------------------------------------------------------------------- 1 | import typing 2 | 3 | from falsy.netboy.curl_loop import CurlLoop 4 | from falsy.netboy.fetch import net_boy 5 | from falsy.netboy.run import run 6 | import pycurl 7 | 8 | 9 | class NetBoy: 10 | class Exception(Exception): 11 | pass 12 | 13 | class Dict(typing.Dict[str, typing.Any]): 14 | def __getattr__(self, name): 15 | # type: (str) -> Any 16 | try: 17 | return self[name] 18 | except KeyError: 19 | # raise NetBoy.Exception('netboy key error: ' + name) 20 | return None # '!netboy key [' + name + '] does not exist' 21 | except Exception: 22 | raise NetBoy.Exception('netboy exception: ' + name) 23 | 24 | def __setattr__(self, name, value): 25 | # type: (str, Any) -> None 26 | self[name] = value 27 | 28 | def __init__(self, payload=None, share=None): 29 | self.payload = payload 30 | if share: 31 | s = pycurl.CurlShare() 32 | s.setopt(pycurl.SH_SHARE, pycurl.LOCK_DATA_COOKIE) 33 | s.setopt(pycurl.SH_SHARE, pycurl.LOCK_DATA_DNS) 34 | s.setopt(pycurl.SH_SHARE, pycurl.LOCK_DATA_SSL_SESSION) 35 | self.share = s 36 | else: 37 | self.share = None 38 | 39 | def run(self, payload=None, loop=None): 40 | real_payload = payload 41 | if self.payload is None: 42 | real_payload = payload 43 | elif payload is None: 44 | real_payload = self.payload 45 | else: 46 | real_payload = self.payload + payload 47 | ress = run(net_boy(real_payload, self.share), loop=loop) 48 | obj_ress = [] 49 | for v in ress: 50 | if type(v) == CurlLoop.CurlException: 51 | boy = NetBoy.Dict(v.data) 52 | # boy['payload'] = real_payload 53 | obj_ress.append(boy) 54 | elif type(v) == dict: 55 | boy = NetBoy.Dict(v) 56 | obj_ress.append(boy) 57 | # else: 58 | # boy = NetBoy.Dict({ 59 | # 'state': 'critical', 60 | # 'spider': 'pycurl', 61 | # 'error_code': -1, 62 | # 'error_desc': "{} - {}".format(type(v), str(v)), 63 | # 'payload': real_payload 64 | # }) 65 | # obj_ress.append(boy) 66 | return obj_ress 67 | -------------------------------------------------------------------------------- /falsy/netboy/run.py: -------------------------------------------------------------------------------- 1 | import asyncio as aio 2 | import json 3 | from contextlib import suppress 4 | 5 | import uvloop 6 | 7 | from falsy.netboy.curl_loop import curl_loop 8 | 9 | 10 | def exception_handler(context): 11 | print('context:', context) 12 | 13 | 14 | def run(coro, loop=None): 15 | async def main_task(): 16 | pycurl_task = aio.ensure_future(curl_loop()) 17 | try: 18 | r = await coro 19 | finally: 20 | pycurl_task.cancel() 21 | with suppress(aio.CancelledError): 22 | await pycurl_task 23 | return r, pycurl_task 24 | 25 | if loop is None: 26 | loop = uvloop.new_event_loop() 27 | # loop = aio.get_event_loop() 28 | aio.set_event_loop(loop) 29 | loop.set_exception_handler(exception_handler) 30 | r, _ = loop.run_until_complete(main_task()) 31 | return r 32 | -------------------------------------------------------------------------------- /falsy/netboy/simple.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from falsy.netboy.fetch import get_boy, post_boy, net_boy 4 | from falsy.netboy.netboy import NetBoy 5 | from falsy.netboy.run import run 6 | 7 | if __name__ == "__main__": 8 | payload = [ 9 | # { 10 | # "url": "http://172.30.0.77:8003/v1/validate", 11 | # "postfields": { 12 | # "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0OTE4ODg2ODQsImNvZGVfaWQiOiJjYWYwZTZlOC0wYTEzLTExZTctOTVhNy0xYzg3MmM3MTBhNDgifQ.SkwAtOX8JW4ZRb2S4cftg7PGveU21DZKzlrBYRK6S9I" 13 | # }, 14 | # 15 | # 'id':2 16 | # }, 17 | # { 18 | # 'url': 'http://www.douban.com', 19 | # 'dns_servers': '114.114.114.114' 20 | # }, 21 | { 22 | 'url': 'http://www.baidu.com', 23 | }, 24 | { 25 | 'url': 'http://www.douban.com', 26 | }, 27 | # { 28 | # 'url': 'http://www.google.com', 29 | # 'dns_servers': '114.114.114.114', 30 | # 'id':1 31 | # }, 32 | ] 33 | # payload=[{'url': 'http://lwjk.hncd.cn:8091/hnjtyjws', 'useragent': 'Mozilla/5.0', 'followlocation': 0, 'aiohttp_timeout': 60, 'connecttimeout': 30, 'timeout': 30}] 34 | boy=NetBoy(payload, share=True) 35 | ress = boy.run() 36 | # print('>>>>>>>>>>.') 37 | # print(ress) 38 | # print(json.dumps(ress,indent=2)) 39 | # ress = run(net_boy(payload)) 40 | # for res in ress: 41 | # if res is None: 42 | # print('res is None') 43 | # continue 44 | # # print(res.data) 45 | # print('>>>>>>') 46 | # # print(res) 47 | # print(res.effective_url) 48 | # print('>>>>2') 49 | # print(res.url) 50 | # # print(res.data) 51 | # print(res.id) 52 | # print('--------links----------') 53 | # for link in res.links: 54 | # print(link) 55 | # # print(link['href']) 56 | # print(res.title) 57 | # print(res.http_code) 58 | # print(json.dumps(res, indent=2)) 59 | # print(json.dumps(res, indent=2)) 60 | # if __name__ == "__main__": 61 | # urls = [ 62 | # # { 63 | # # 'url': 'http://louisville.bncollege.com/', 64 | # # 'url': 'http://case.bncollege.com/', 65 | # # 'noprogress': False, 66 | # # 'useragent': 'Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0', 67 | # # 'cookiejar': 'aa.lwp', 68 | # # 'cookiefile': 'aa.lwp', 69 | # # }, 70 | # { 71 | # 'url': 'http://www.douban.com', 72 | # 'dns_servers': '114.114.114.114' 73 | # }, 74 | # # { 75 | # # 'url': 'http://www.google.com', 76 | # # 'dns_servers': '8.8.8.8' 77 | # # }, 78 | # ] 79 | # ress=run(get_boy(urls)) 80 | # for res in ress: 81 | # if res is None: 82 | # print('res is None') 83 | # continue 84 | # res['data'] = res['data'][:80] 85 | # print(json.dumps(res, indent=2)) 86 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/__init__.py -------------------------------------------------------------------------------- /falsy/swagger_proxy/spec_loader.py: -------------------------------------------------------------------------------- 1 | import pprint 2 | 3 | import falcon 4 | import json 5 | import logging 6 | 7 | 8 | from falcon.routing import compile_uri_template 9 | 10 | from falsy.loader.func import load 11 | 12 | logging.basicConfig(level=logging.INFO) 13 | log = logging.getLogger(__name__) 14 | 15 | 16 | class SpecLoader: 17 | def __init__(self, log=None): 18 | self.specs = {} 19 | self.log = log 20 | 21 | def load_specs(self, swagger_spec): 22 | self.log.info("load swagger specs") 23 | try: 24 | swagger_spec = json.loads(swagger_spec) if type(swagger_spec) == str else swagger_spec 25 | except: 26 | self.log.error_trace("Unable to parse the Swagger spec JSON document.") 27 | raise Exception("Unable to parse the Swagger spec JSON document.") 28 | try: 29 | self.specs['basePath'] = swagger_spec.get('basePath') 30 | self.specs['consumes'] = swagger_spec.get('consumes') 31 | self.specs['produces'] = swagger_spec.get('produces') 32 | self.specs['beforeId'] = self.load_handler(swagger_spec.get('beforeId')) 33 | self.specs['afterId'] = self.load_handler(swagger_spec.get('afterId')) 34 | self.specs['exceptionId'] = self.load_handler(swagger_spec.get('exceptionId')) 35 | self.specs['finalId'] = self.load_handler(swagger_spec.get('finalId')) 36 | for path, path_content in swagger_spec['paths'].items(): 37 | self.load_paths(path, path_content, swagger_spec) 38 | except: 39 | raise Exception("Unable to build routing table from provided Swagger spec.") 40 | # pprint.pprint(self.specs) 41 | return self.specs 42 | 43 | def load_paths(self, path, path_content, swagger_spec): 44 | for method, method_content in path_content.items(): 45 | self.load_methods(method, method_content, path, swagger_spec) 46 | 47 | def load_methods(self, method, method_content, path, swagger_spec): 48 | uri_fields, uri_regex = compile_uri_template( 49 | '/' + method.lower() + swagger_spec['basePath'] + path) 50 | self.specs[uri_regex] = {'uri_fields': uri_fields} 51 | for attribute, attribute_content in method_content.items(): 52 | if attribute in ['beforeId', 'afterId', 'operationId', 'validationId', 'exceptionId', 'finalId']: 53 | attribute_content = self.load_handler(attribute_content) 54 | self.load_attributes(attribute, attribute_content, swagger_spec, uri_regex) 55 | self.specs[uri_regex]['path'] = path 56 | 57 | def load_attributes(self, attribute, attribute_content, swagger_spec, uri_regex): 58 | self.specs[uri_regex][attribute] = attribute_content 59 | if attribute == 'parameters': 60 | for i, param in enumerate(attribute_content): 61 | if param.get('in') == 'body': 62 | schema = param.get('schema') 63 | ref = schema.get('$ref') 64 | if ref: 65 | self.specs[uri_regex]['schema'] = swagger_spec['definitions'][ 66 | ref[ref.rfind('/') + 1:]] 67 | else: 68 | self.specs[uri_regex]['schema'] = schema 69 | 70 | self.specs[uri_regex][attribute][i]['validationId'] = self.load_handler(param.get('validationId')) 71 | 72 | def load_handler(self, name): 73 | if name is None: 74 | return None 75 | return load(name) 76 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_bootstrap/1.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "/v1", 3 | "consumes": [ 4 | "application/json" 5 | ], 6 | "swagger": "2.0", 7 | "info": { 8 | "title": "FALSY SIMPLE DEMO API", 9 | "version": "0.1", 10 | "contact": { 11 | "name": "xiaoym@drore.com" 12 | }, 13 | "license": {} 14 | }, 15 | "host": "172.30.0.77:8001", 16 | "tags": [ 17 | { 18 | "name": "GET", 19 | "description": "地址管理" 20 | }, 21 | { 22 | "name": "POST", 23 | "description": "地址管理" 24 | } 25 | ], 26 | "basePath": "v1/", 27 | "paths": { 28 | "/hello": { 29 | "get": { 30 | "parameters": [ 31 | { 32 | "default": "john", 33 | "in": "query", 34 | "name": "name", 35 | "type": "string" 36 | } 37 | ], 38 | "responses": { 39 | "200": { 40 | "description": "Return response" 41 | } 42 | }, 43 | "summary": "\u6d4b\u8bd5get\u8bf7\u6c42", 44 | "tags": [ 45 | "GET" 46 | ], 47 | "consumes": [ 48 | "application/json" 49 | ], 50 | "produces": [ 51 | "*/*" 52 | ] 53 | }, 54 | "post": { 55 | "parameters": [ 56 | { 57 | "default": "john", 58 | "in": "query", 59 | "name": "name", 60 | "type": "string" 61 | } 62 | ], 63 | "responses": { 64 | "200": { 65 | "description": "Return response" 66 | } 67 | }, 68 | "summary": "\u6d4b\u8bd5post\u8bf7\u6c42", 69 | "tags": [ 70 | "POST" 71 | ], 72 | "consumes": [ 73 | "application/json" 74 | ], 75 | "produces": [ 76 | "*/*" 77 | ] 78 | } 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/bootstrap/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/images/api.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/images/api.ico -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_bootstrap/webjars/drore-document-ui/jsonview/jquery.jsonview.min.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8";.jsonview{font-family:monospace;font-size:1.1em;white-space:pre-wrap}.jsonview .prop{font-weight:700;text-decoration:none;color: #4a0; 2 | font-weight: bold;font-size: 16px; 3 | display: inline;}.jsonview .null,.jsonview .undefined{color:red}.jsonview .bool,.jsonview .num{color: #f63;font-size:16px;font-weight: bold;}.jsonview .string{color: #f63;font-size:16px;white-space:pre-wrap;}.jsonview .string.multiline{display:inline-block;vertical-align:text-top}.jsonview .collapser{position:absolute;left:-1em;cursor:pointer}.jsonview .collapsible{transition:height 1.2s;transition:width 1.2s}.jsonview .collapsible.collapsed{height:.8em;width:1em;display:inline-block;overflow:hidden;margin:0}.jsonview .collapsible.collapsed:before{content:"…";width:1em;margin-left:.2em}.jsonview .collapser.collapsed{transform:rotate(0)}.jsonview .q{display:inline-block;width:0;color:transparent}.jsonview li{position:relative}.jsonview ul{list-style:none;margin:0 0 0 2em;padding:0}.jsonview h1{font-size:1.2em} -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_impress/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_impress/favicon-16x16.png -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_impress/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_impress/favicon-32x32.png -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_impress/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_impress/favicon.ico -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_impress/images/clippy.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_impress/images/noun-117716-404-error.svg: -------------------------------------------------------------------------------- 1 | GroupCreated with Sketch. -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_impress/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_impress/images/throbber.gif -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_impress/lib/html5shiv.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by dameng on 3/9/17. 3 | */ 4 | 5 | /** 6 | * @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 7 | */ 8 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_impress/o2c.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/auth.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OAuth 2.0 Callback 6 | 7 | 29 | 30 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/auth.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/after-explorer/xml-formatter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Orange angular-swagger-ui - v0.3.0 3 | * 4 | * (C) 2015 Orange, all right reserved 5 | * MIT Licensed 6 | */ 7 | 'use strict'; 8 | 9 | angular.module('sw.plugin.xmlFormater', ['sw.plugins']) 10 | .factory('xmlFormatter', function ($q, $log) { 11 | $log.debug('sw:plugin', 'xmlFormater'); 12 | 13 | return { 14 | execute: execute 15 | }; 16 | 17 | function execute (response) { 18 | $log.debug('sw:execute', 'xmlFormater'); 19 | 20 | var executed = false; 21 | var deferred = $q.defer(); 22 | var contentType = response.headers && response.headers()['content-type']; 23 | 24 | if (contentType && contentType.toLowerCase().indexOf('/xml') > 0) { 25 | response.data = formatXml(response.data); 26 | executed = true; 27 | } 28 | deferred.resolve(executed); 29 | return deferred.promise; 30 | } 31 | 32 | function formatXml (xml) { 33 | var formatted = ''; 34 | var reg = /(>)(<)(\/*)/g; 35 | var pad = 0; 36 | 37 | xml = xml.replace(reg, '$1\r\n$2$3'); 38 | angular.forEach(xml.split('\r\n'), function (node) { 39 | var indent = 0; 40 | var padding = ''; 41 | 42 | if (node.match(/.+<\/\w[^>]*>$/)) { 43 | indent = 0; 44 | } else if (node.match(/^<\/\w/)) { 45 | if (pad !== 0) { 46 | pad -= 1; 47 | } 48 | } else if (node.match(/^<\w[^>]*[^\/]>.*$/)) { 49 | indent = 1; 50 | } else { 51 | indent = 0; 52 | } 53 | 54 | for (var i = 0; i < pad; i++) { 55 | padding += ' '; 56 | } 57 | 58 | formatted += padding + node + '\r\n'; 59 | pad += indent; 60 | }); 61 | 62 | return formatted; 63 | } 64 | }) 65 | .run(function (plugins, xmlFormatter) { 66 | plugins.add(plugins.AFTER_EXPLORER_LOAD, xmlFormatter); 67 | }); 68 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/after-explorer/xml-formatter.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.xmlFormater",["sw.plugins"]).factory("xmlFormatter",["$q","$log",function(r,e){function t(t){e.debug("sw:execute","xmlFormater");var n=!1,u=r.defer(),o=t.headers&&t.headers()["content-type"];return o&&o.toLowerCase().indexOf("/xml")>0&&(t.data=a(t.data),n=!0),u.resolve(n),u.promise}function a(r){var e="",t=/(>)(<)(\/*)/g,a=0;return r=r.replace(t,"$1\r\n$2$3"),angular.forEach(r.split("\r\n"),function(r){var t=0,n="";r.match(/.+<\/\w[^>]*>$/)?t=0:r.match(/^<\/\w/)?0!==a&&(a-=1):t=r.match(/^<\w[^>]*[^\/]>.*$/)?1:0;for(var u=0;a>u;u++)n+=" ";e+=n+r+"\r\n",a+=t}),e}return e.debug("sw:plugin","xmlFormater"),{execute:t}}]).run(["plugins","xmlFormatter",function(r,e){r.add(r.AFTER_EXPLORER_LOAD,e)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-display/markdown.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('sw.plugin.markdown', ['sw.plugins']) 4 | .factory('markdown', function ($q, $log, $window) { 5 | $log.debug('sw:plugin', 'markdown'); 6 | 7 | var showdown = new $window.showdown.Converter({ 8 | simplifiedAutoLink: true, 9 | tables: true, 10 | ghCodeBlocks: true, 11 | tasklists: true 12 | }); 13 | 14 | return { 15 | execute: execute 16 | }; 17 | 18 | function execute (parseResult) { 19 | $log.debug('sw:execute', 'markdown'); 20 | 21 | var deferred = $q.defer(); 22 | 23 | // TODO: is there any other GFM field to be transformed? Find "GFM" in http://swagger.io/specification/ page 24 | 25 | if (parseResult.info && parseResult.info.description) { 26 | parseResult.info.description = markdown(parseResult.info.description.replace(/^
/i, '')); 27 | } 28 | 29 | angular.forEach(parseResult.securityDefinitions, function (sec) { 30 | var d = sec.description || ''; 31 | 32 | // Obvious descriptions 33 | if (sec.type === 'apiKey' && d.toLowerCase() === 'API Key Authentication'.toLowerCase()) { 34 | delete sec.description; 35 | } else if (sec.type === 'basic' && d.toLowerCase() === 'Basic HTTP Authentication'.toLowerCase()) { 36 | delete sec.description; 37 | } else if (sec.type === 'oauth2' && d.toLowerCase() === 'OAuth 2.0 Authentication'.toLowerCase()) { 38 | delete sec.description; 39 | } else { 40 | sec.description = markdown(sec.description); 41 | } 42 | }); 43 | 44 | angular.forEach(parseResult.resources, function (resource) { 45 | resource.description = markdown(resource.description); 46 | 47 | angular.forEach(resource.operations, function (operation) { 48 | operation.description = markdown(operation.description); 49 | 50 | // TODO: remove workaround? http://darosh.github.io/angular-swagger-ui-material/#?url=https:%2F%2Fapi.apis.guru%2Fspecs%2Fwinning.email%2F1.0.0%2Fswagger.json 51 | operation.summary = operation.summary ? operation.summary.replace(/(
)+$/, '') : operation.summary; 52 | 53 | angular.forEach(operation.responses, function (response) { 54 | response.description = markdown(response.description); 55 | }); 56 | }); 57 | }); 58 | 59 | deferred.resolve(); 60 | 61 | return deferred.promise; 62 | } 63 | 64 | function markdown (text) { 65 | return showdown.makeHtml(text || ''); 66 | } 67 | }) 68 | .run(function (plugins, markdown) { 69 | plugins.add(plugins.BEFORE_DISPLAY, markdown); 70 | }); 71 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-display/markdown.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.markdown",["sw.plugins"]).factory("markdown",["$q","$log","$window",function(e,i,o){function n(o){i.debug("sw:execute","markdown");var n=e.defer();return o.info&&o.info.description&&(o.info.description=r(o.info.description.replace(/^
/i,""))),angular.forEach(o.securityDefinitions,function(e){var i=e.description||"";"apiKey"===e.type&&i.toLowerCase()==="API Key Authentication".toLowerCase()?delete e.description:"basic"===e.type&&i.toLowerCase()==="Basic HTTP Authentication".toLowerCase()?delete e.description:"oauth2"===e.type&&i.toLowerCase()==="OAuth 2.0 Authentication".toLowerCase()?delete e.description:e.description=r(e.description)}),angular.forEach(o.resources,function(e){e.description=r(e.description),angular.forEach(e.operations,function(e){e.description=r(e.description),e.summary=e.summary?e.summary.replace(/(
)+$/,""):e.summary,angular.forEach(e.responses,function(e){e.description=r(e.description)})})}),n.resolve(),n.promise}function r(e){return t.makeHtml(e||"")}i.debug("sw:plugin","markdown");var t=new o.showdown.Converter({simplifiedAutoLink:!0,tables:!0,ghCodeBlocks:!0,tasklists:!0});return{execute:n}}]).run(["plugins","markdown",function(e,i){e.add(e.BEFORE_DISPLAY,i)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-display/operations.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('sw.plugin.operations', ['sw.plugins']) 4 | // List ungrouped operations 5 | .factory('operations', function ($q) { 6 | return { 7 | execute: function (parseResult) { 8 | var deferred = $q.defer(); 9 | 10 | parseResult.info.operations = []; 11 | 12 | angular.forEach(parseResult.resources, function (resource) { 13 | angular.forEach(resource.operations, function (operation) { 14 | parseResult.info.operations.push(operation); 15 | }); 16 | 17 | // TODO: allow configuration of minimum auto expanded endpoints 18 | if (parseResult.resources.length <= 8) { 19 | resource.open = true; 20 | } 21 | }); 22 | 23 | parseResult.info.operations.sort(function (a, b) { 24 | return (a.path.toLowerCase().replace(/[^a-z]+/gi, '') + '-' + a.httpMethod) 25 | .localeCompare(b.path.toLowerCase().replace(/[^a-z]+/gi, '') + '-' + b.httpMethod); 26 | }); 27 | 28 | deferred.resolve(); 29 | 30 | return deferred.promise; 31 | } 32 | }; 33 | }) 34 | .run(function (plugins, operations) { 35 | plugins.add(plugins.BEFORE_DISPLAY, operations); 36 | }); 37 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-display/operations.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.operations",["sw.plugins"]).factory("operations",["$q",function(o){return{execute:function(e){var r=o.defer();return e.info.operations=[],angular.forEach(e.resources,function(o){angular.forEach(o.operations,function(o){e.info.operations.push(o)}),e.resources.length<=8&&(o.open=!0)}),e.info.operations.sort(function(o,e){return(o.path.toLowerCase().replace(/[^a-z]+/gi,"")+"-"+o.httpMethod).localeCompare(e.path.toLowerCase().replace(/[^a-z]+/gi,"")+"-"+e.httpMethod)}),r.resolve(),r.promise}}}]).run(["plugins","operations",function(o,e){o.add(o.BEFORE_DISPLAY,e)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-display/sort.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('sw.plugin.sort', ['sw.plugins']) 4 | .factory('sort', function ($q) { 5 | var order = { 6 | get: 1, 7 | head: 2, 8 | options: 3, 9 | post: 4, 10 | put: 5, 11 | patch: 6, 12 | delete: 7 13 | }; 14 | 15 | return { 16 | execute: function (parseResult) { 17 | var deferred = $q.defer(); 18 | 19 | angular.forEach(parseResult.resources, function (resource) { 20 | resource.operations.sort(function (a, b) { 21 | return (a.path.toLowerCase().replace(/[^a-z]+/gi, '') + '-' + (order[a.httpMethod] || 9)) 22 | .localeCompare(b.path.toLowerCase().replace(/[^a-z]+/gi, '') + '-' + (order[b.httpMethod] || 9)); 23 | }); 24 | }); 25 | 26 | deferred.resolve(true); 27 | 28 | return deferred.promise; 29 | } 30 | }; 31 | }) 32 | .run(function (plugins, sort) { 33 | plugins.add(plugins.BEFORE_DISPLAY, sort); 34 | }); 35 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-display/sort.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.sort",["sw.plugins"]).factory("sort",["$q",function(e){var t={get:1,head:2,options:3,post:4,put:5,patch:6,"delete":7};return{execute:function(r){var o=e.defer();return angular.forEach(r.resources,function(e){e.operations.sort(function(e,r){return(e.path.toLowerCase().replace(/[^a-z]+/gi,"")+"-"+(t[e.httpMethod]||9)).localeCompare(r.path.toLowerCase().replace(/[^a-z]+/gi,"")+"-"+(t[r.httpMethod]||9))})}),o.resolve(!0),o.promise}}}]).run(["plugins","sort",function(e,t){e.add(e.BEFORE_DISPLAY,t)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-explorer/auth.sample.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('sw.plugin.auth', ['sw.plugins']) 4 | .factory('auth', function ($q/* , $window */) { 5 | return { 6 | execute: function (/* options */) { 7 | var deferred = $q.defer(); 8 | 9 | /* Add auth key to params 10 | 11 | options.params.auth_key = '...'; 12 | */ 13 | 14 | /* Basic HTTP Authentication 15 | 16 | var username = '...'; 17 | var password = '...'; 18 | var auth = $window.btoa(username + ':' + password); 19 | options.headers['Authorization'] = 'Basic ' + auth; 20 | */ 21 | 22 | deferred.resolve(); 23 | 24 | return deferred.promise; 25 | } 26 | }; 27 | }) 28 | .run(function (plugins, auth) { 29 | plugins.add(plugins.BEFORE_EXPLORER_LOAD, auth); 30 | }); 31 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-explorer/auth.sample.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.auth",["sw.plugins"]).factory("auth",["$q",function(u){return{execute:function(){var n=u.defer();return n.resolve(),n.promise}}}]).run(["plugins","auth",function(u,n){u.add(u.BEFORE_EXPLORER_LOAD,n)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-explorer/transform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('sw.plugin.transform', ['sw.plugins']) 4 | // Catch default transform invalid JSON parse 5 | .factory('transform', function ($q, $http) { 6 | return { 7 | execute: function (config) { 8 | var deferred = $q.defer(); 9 | 10 | config.transformResponse = function (data, headersGetter, status) { 11 | try { 12 | return $http.defaults.transformResponse[0](data, headersGetter, status); 13 | } catch (ing) { 14 | return data; 15 | } 16 | }; 17 | 18 | deferred.resolve(); 19 | 20 | return deferred.promise; 21 | } 22 | }; 23 | }) 24 | .run(function (plugins, transform) { 25 | plugins.add(plugins.BEFORE_EXPLORER_LOAD, transform); 26 | }); 27 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-explorer/transform.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.transform",["sw.plugins"]).factory("transform",["$q","$http",function(r,n){return{execute:function(t){var e=r.defer();return t.transformResponse=function(r,t,e){try{return n.defaults.transformResponse[0](r,t,e)}catch(s){return r}},e.resolve(),e.promise}}}]).run(["plugins","transform",function(r,n){r.add(r.BEFORE_EXPLORER_LOAD,n)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-load/yaml.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('sw.plugin.yaml', ['sw.plugins']) 4 | .factory('yaml', function ($q, $window) { 5 | return { 6 | execute: function (options) { 7 | var deferred = $q.defer(); 8 | 9 | options.transformResponse = function (data, headersGetter) { 10 | try { 11 | return angular.fromJson(data); 12 | } catch (ign) { 13 | try { 14 | var obj = $window.jsyaml.safeLoad(data); 15 | 16 | headersGetter()['content-type'] = 'application/json'; 17 | 18 | return obj; 19 | } catch (ign) { 20 | return data; 21 | } 22 | } 23 | }; 24 | 25 | deferred.resolve(); 26 | 27 | return deferred.promise; 28 | } 29 | }; 30 | }) 31 | .run(function (plugins, yaml) { 32 | plugins.add(plugins.BEFORE_LOAD, yaml); 33 | }); 34 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-load/yaml.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.yaml",["sw.plugins"]).factory("yaml",["$q","$window",function(n,r){return{execute:function(t){var e=n.defer();return t.transformResponse=function(n,t){try{return angular.fromJson(n)}catch(e){try{var a=r.jsyaml.safeLoad(n);return t()["content-type"]="application/json",a}catch(e){return n}}},e.resolve(),e.promise}}}]).run(["plugins","yaml",function(n,r){n.add(n.BEFORE_LOAD,r)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-parse/base.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('sw.plugin.base', ['sw.plugins']) 4 | .factory('base', function ($q, $log) { 5 | return { 6 | execute: execute 7 | }; 8 | 9 | function execute (url, swagger) { 10 | $log.debug('sw:plugin', 'base'); 11 | 12 | var deferred = $q.defer(); 13 | 14 | if (swagger && swagger.paths) { 15 | var parts = {}; 16 | var min = Number.MAX_VALUE; 17 | 18 | angular.forEach(swagger.paths, function (path, key) { 19 | parts[key] = key.split('/'); 20 | 21 | if (key[0] === '/') { 22 | parts[key].shift(); 23 | } 24 | 25 | min = Math.min(min, parts[key].length); 26 | }); 27 | 28 | var paths = Object.keys(swagger.paths); 29 | var sames = []; 30 | 31 | for (var i = 0; i < min; i++) { 32 | var first = parts[paths[0]][i]; 33 | 34 | if (/\{.+\}/.test(first) || (parts[paths[0]].length <= 1)) { 35 | break; 36 | } 37 | 38 | var same = true; 39 | 40 | for (var j = 0; j < paths.length; j++) { 41 | if (parts[paths[j]][i] !== first) { 42 | same = false; 43 | break; 44 | } 45 | } 46 | 47 | if (same) { 48 | sames.push(first); 49 | } else { 50 | break; 51 | } 52 | } 53 | 54 | if (sames.length > 0) { 55 | var extracted = sames.join('/'); 56 | 57 | $log.debug('sw:plugin:base:extracted', extracted); 58 | 59 | swagger.basePath = (swagger.basePath || '/'); 60 | swagger.basePath = swagger.basePath + 61 | ((swagger.basePath[swagger.basePath.length - 1] === '/') ? '' : '/') + extracted; 62 | 63 | angular.forEach(paths, function (path) { 64 | swagger.paths['/' + parts[path].slice(sames.length).join('/')] = swagger.paths[path]; 65 | delete swagger.paths[path]; 66 | }); 67 | } 68 | } 69 | 70 | deferred.resolve(true); 71 | 72 | return deferred.promise; 73 | } 74 | }) 75 | .run(function (plugins, base) { 76 | plugins.add(plugins.BEFORE_PARSE, base); 77 | }); 78 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-parse/base.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.base",["sw.plugins"]).factory("base",["$q","$log",function(a,e){function t(t,s){e.debug("sw:plugin","base");var n=a.defer();if(s&&s.paths){var r={},h=Number.MAX_VALUE;angular.forEach(s.paths,function(a,e){r[e]=e.split("/"),"/"===e[0]&&r[e].shift(),h=Math.min(h,r[e].length)});for(var i=Object.keys(s.paths),u=[],l=0;h>l;l++){var b=r[i[0]][l];if(/\{.+\}/.test(b)||r[i[0]].length<=1)break;for(var f=!0,g=0;g0){var o=u.join("/");e.debug("sw:plugin:base:extracted",o),s.basePath=s.basePath||"/",s.basePath=s.basePath+("/"===s.basePath[s.basePath.length-1]?"":"/")+o,angular.forEach(i,function(a){s.paths["/"+r[a].slice(u.length).join("/")]=s.paths[a],delete s.paths[a]})}}return n.resolve(!0),n.promise}return{execute:t}}]).run(["plugins","base",function(a,e){a.add(a.BEFORE_PARSE,e)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-parse/external-references.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Orange angular-swagger-ui - v0.3.0 3 | * 4 | * (C) 2015 Orange, all right reserved 5 | * MIT Licensed 6 | */ 7 | 'use strict'; 8 | 9 | angular.module('sw.plugin.externalReferences', ['sw.plugins']) 10 | .factory('externalReferences', function ($http, $q, $window, plugins) { 11 | var deferred; 12 | 13 | return { 14 | /** 15 | * Module entry point 16 | */ 17 | execute: function (url, swagger) { 18 | deferred = $q.defer(); 19 | loadExternalReferences(url, swagger); 20 | 21 | return deferred.promise; 22 | } 23 | }; 24 | 25 | function onError (error) { 26 | deferred.reject(error); 27 | } 28 | 29 | /** 30 | * Load external definition 31 | */ 32 | function getUrl (externalUrl, callback) { 33 | var options = { 34 | method: 'GET', 35 | url: externalUrl 36 | }; 37 | 38 | plugins 39 | .execute(plugins.BEFORE_LOAD, options) 40 | .then(function () { 41 | $http(options).then(callback, onError); 42 | }) 43 | .catch(onError); 44 | } 45 | 46 | /** 47 | * Generate external URL 48 | */ 49 | function getExternalUrl (baseUrl, $ref) { 50 | if (!angular.isString($ref)) { 51 | return ''; 52 | } 53 | 54 | var parts = $ref.split('#/'); 55 | var externalUrl = parts[0]; 56 | 57 | if (externalUrl && (externalUrl.indexOf('http') !== 0)) { 58 | // relative url 59 | if (externalUrl.indexOf('/') === 0) { 60 | var swaggerUrlParts = $window.URL.parse(baseUrl); 61 | externalUrl = swaggerUrlParts.protocol + '//' + swaggerUrlParts.host + externalUrl; 62 | } else { 63 | var pos = baseUrl.lastIndexOf('/'); 64 | externalUrl = baseUrl.substring(0, pos) + '/' + externalUrl; 65 | } 66 | } 67 | 68 | return externalUrl; 69 | } 70 | 71 | /** 72 | * Find and resolve external definitions 73 | */ 74 | function loadExternalReferences (baseUrl, swagger) { 75 | var loading = 0; 76 | 77 | function load (url, obj) { 78 | loading++; 79 | 80 | getUrl(url, function (json) { 81 | loading--; 82 | 83 | var subPath = obj.$ref.split('#/')[1]; 84 | var subJson = subPath ? json.data[subPath] : json.data; 85 | 86 | angular.extend(obj, subJson); 87 | 88 | delete obj.$ref; 89 | 90 | if (loading === 0) { 91 | deferred.resolve(true); 92 | } 93 | }); 94 | } 95 | 96 | function iterate (obj) { 97 | angular.forEach(obj, function (v, k) { 98 | if (k === '$ref') { 99 | var externalUrl = getExternalUrl(baseUrl, v); 100 | 101 | if (externalUrl) { 102 | load(externalUrl, obj); 103 | } 104 | } else if (angular.isObject(v) || angular.isArray(v)) { 105 | iterate(v); 106 | } 107 | }); 108 | } 109 | 110 | iterate(swagger); 111 | 112 | if (!loading) { 113 | deferred.resolve(false); 114 | } 115 | } 116 | }) 117 | .run(function (plugins, externalReferences) { 118 | plugins.add(plugins.BEFORE_PARSE, externalReferences); 119 | }); 120 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-parse/external-references.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.externalReferences",["sw.plugins"]).factory("externalReferences",["$http","$q","$window","plugins",function(e,n,r,t){function a(e){c.reject(e)}function u(n,r){var u={method:"GET",url:n};t.execute(t.BEFORE_LOAD,u).then(function(){e(u).then(r,a)})["catch"](a)}function i(e,n){if(!angular.isString(n))return"";var t=n.split("#/"),a=t[0];if(a&&0!==a.indexOf("http"))if(0===a.indexOf("/")){var u=r.URL.parse(e);a=u.protocol+"//"+u.host+a}else{var i=e.lastIndexOf("/");a=e.substring(0,i)+"/"+a}return a}function f(e,n){function r(e,n){a++,u(e,function(e){a--;var r=n.$ref.split("#/")[1],t=r?e.data[r]:e.data;angular.extend(n,t),delete n.$ref,0===a&&c.resolve(!0)})}function t(n){angular.forEach(n,function(a,u){if("$ref"===u){var f=i(e,a);f&&r(f,n)}else(angular.isObject(a)||angular.isArray(a))&&t(a)})}var a=0;t(n),a||c.resolve(!1)}var c;return{execute:function(e,r){return c=n.defer(),f(e,r),c.promise}}}]).run(["plugins","externalReferences",function(e,n){e.add(e.BEFORE_PARSE,n)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-parse/split.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('sw.plugin.split', ['sw.plugins']) 4 | .factory('split', function ($q) { 5 | return { 6 | execute: execute 7 | }; 8 | 9 | function execute (url, swagger) { 10 | var deferred = $q.defer(); 11 | 12 | if (swagger && swagger.swagger && !swagger.tags) { 13 | var tags = {}; 14 | 15 | angular.forEach(swagger.paths, function (path, key) { 16 | var t = key.replace(/^\/?([^\/]+).*$/g, '$1'); 17 | tags[t] = true; 18 | 19 | angular.forEach(path, function (method) { 20 | if (!method.tags || !method.tags.length) { 21 | method.tags = [t]; 22 | } 23 | }); 24 | }); 25 | 26 | swagger.tags = []; 27 | 28 | Object.keys(tags).forEach(function (tag) { 29 | swagger.tags.push({name: tag}); 30 | }); 31 | } 32 | 33 | deferred.resolve(true); 34 | 35 | return deferred.promise; 36 | } 37 | }) 38 | .run(function (plugins, split) { 39 | plugins.add(plugins.BEFORE_PARSE, split); 40 | }); 41 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-parse/split.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.split",["sw.plugins"]).factory("split",["$q",function(a){function t(t,n){var r=a.defer();if(n&&n.swagger&&!n.tags){var s={};angular.forEach(n.paths,function(a,t){var n=t.replace(/^\/?([^\/]+).*$/g,"$1");s[n]=!0,angular.forEach(a,function(a){a.tags&&a.tags.length||(a.tags=[n])})}),n.tags=[],Object.keys(s).forEach(function(a){n.tags.push({name:a})})}return r.resolve(!0),r.promise}return{execute:t}}]).run(["plugins","split",function(a,t){a.add(a.BEFORE_PARSE,t)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/before-parse/swagger-1-to-2.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugin.swagger1to2",["sw.plugins"]).factory("swagger1to2",["$q","$http","plugins",function(e,s,t){function r(r){var n=e.defer(),o={method:"GET",url:r};return t.execute(t.BEFORE_LOAD,o).then(function(){s(o).success(n.resolve).error(n.reject)})["catch"](n.reject),n.promise}function n(s,t,n){var i=n,c=i.info=i.info||{},f=[];c.contact={email:c.contact},c.license={name:c.license,url:c.licenseUrl},c.termsOfService=c.termsOfServiceUrl,i.paths={},i.definitions={},i.tags=[],angular.forEach(i.apis,function(e){f.push(r(t+e.path))}),e.all(f).then(function(e){angular.forEach(e,function(e){o(e,i),a(e,i),p(e,i)}),i.swagger="2.0",s.resolve(!0)})["catch"](s.reject)}function o(e,s){if(s.info.version=s.info.version||e.apiVersion,s.basePath=s.basePath||e.basePath,0===s.basePath.indexOf("http")){var t=angular.element('')[0];s.schemes=[t.protocol.replace(":","")],s.host=t.host,s.basePath=t.pathname}s.info.title=s.info.title||s.host,s.tags.push({name:e.resourcePath})}function a(e,s){var t,r;angular.forEach(e.apis,function(n){t=s.paths[n.path]=s.paths[n.path]||{},angular.forEach(n.operations,function(s){r={},t[s.method.toLowerCase()]={deprecated:s.deprecated,description:s.notes,summary:s.summary,operationId:s.nickname,produces:s.produces||e.produces,consumes:s.consumes||e.consumes,parameters:s.parameters,responses:r,tags:[e.resourcePath]},i(e,s),c(e,s,r)})})}function i(e,s){angular.forEach(s.parameters,function(s){s["in"]=s.paramType;var t=s.type||s.$ref;e.models&&t&&e.models[t]&&(s.schema={$ref:"#/definitions/"+t},delete s.type)})}function c(e,s,t){var r;angular.forEach(s.responseMessages,function(n){if(r=t[n.code]={description:n.message},n.responseModel)e.models&&e.models[n.responseModel]?r.schema={$ref:"#/definitions/"+n.responseModel}:r.type=n.responseModel;else if(200===n.code&&"void"!==s.type&&(e.models&&e.models[s.type]?r.schema={type:s.type,$ref:"#/definitions/"+s.type}:r.schema={type:s.type},"array"===s.type)){var o=s.items.type||s.items.$ref,a=r.schema.items={};e.models&&e.models[o]?a.$ref="#/definitions/"+o:a.type=o}})}function p(e,s){var t;angular.forEach(e.models,function(r,n){s.definitions[n]=r,r.subTypes&&(angular.forEach(r.subTypes,function(s){t=e.models&&e.models[s],t&&(r.required=(r.required||[]).concat(t.required||[]),angular.forEach(t.properties,function(e,s){r.properties[s]=e}))}),delete r.subTypes),angular.forEach(r.properties,function(s){var t=s.type||s.$ref;e.models&&t&&e.models[t]&&(s.$ref="#/definitions/"+t,delete s.type),s.items&&(t=s.items.type||s.items.$ref,e.models&&t&&e.models[t]&&(s.items.$ref="#/definitions/"+t),delete s.items.type)})})}return{execute:function(s,t){var r=e.defer(),o=t.swaggerVersion;return o&&0===o.indexOf("1.")?n(r,s,t):r.resolve(!1),r.promise}}}]).run(["plugins","swagger1to2",function(e,s){e.add(e.BEFORE_PARSE,s)}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/plugins.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Orange angular-swagger-ui - v0.3.0 3 | * 4 | * (C) 2015 Orange, all right reserved 5 | * MIT Licensed 6 | */ 7 | 'use strict'; 8 | 9 | angular 10 | .module('sw.plugins', []).factory('plugins', function ($q) { 11 | var modules = {}; 12 | 13 | return { 14 | BEFORE_LOAD: 'BEFORE_LOAD', 15 | BEFORE_PARSE: 'BEFORE_PARSE', 16 | PARSE: 'PARSE', 17 | BEFORE_DISPLAY: 'BEFORE_DISPLAY', 18 | BEFORE_EXPLORER_LOAD: 'BEFORE_EXPLORER_LOAD', 19 | AFTER_EXPLORER_LOAD: 'AFTER_EXPLORER_LOAD', 20 | 21 | /** 22 | * Adds a new module to swagger-ui 23 | */ 24 | add: function (phase, module) { 25 | if (!modules[phase]) { 26 | modules[phase] = []; 27 | } 28 | if (modules[phase].indexOf(module) < 0) { 29 | modules[phase].push(module); 30 | } 31 | }, 32 | /** 33 | * Executes modules' phase 34 | */ 35 | execute: function () { 36 | var args = Array.prototype.slice.call(arguments); 37 | var phase = args.splice(0, 1); 38 | var deferred = $q.defer(); 39 | var phaseModules = modules[phase] || []; 40 | 41 | executeAll(deferred, [].concat(phaseModules), args); 42 | return deferred.promise; 43 | } 44 | }; 45 | 46 | /** 47 | * Runs modules' "execute" function one by one 48 | */ 49 | function executeAll (deferred, phaseModules, args, phaseExecuted) { 50 | var module = phaseModules.shift(); 51 | if (module) { 52 | module 53 | .execute.apply(module, args) 54 | .then(function (executed) { 55 | phaseExecuted = phaseExecuted || executed; 56 | executeAll(deferred, phaseModules, args, phaseExecuted); 57 | }) 58 | .catch(deferred.reject); 59 | } else { 60 | deferred.resolve(phaseExecuted); 61 | } 62 | } 63 | }); 64 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_material/plugins/plugins.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("sw.plugins",[]).factory("plugins",["$q",function(E){function e(E,R,t,O){var n=R.shift();n?n.execute.apply(n,t).then(function(n){O=O||n,e(E,R,t,O)})["catch"](E.reject):E.resolve(O)}var R={};return{BEFORE_LOAD:"BEFORE_LOAD",BEFORE_PARSE:"BEFORE_PARSE",PARSE:"PARSE",BEFORE_DISPLAY:"BEFORE_DISPLAY",BEFORE_EXPLORER_LOAD:"BEFORE_EXPLORER_LOAD",AFTER_EXPLORER_LOAD:"AFTER_EXPLORER_LOAD",add:function(E,e){R[E]||(R[E]=[]),R[E].indexOf(e)<0&&R[E].push(e)},execute:function(){var t=Array.prototype.slice.call(arguments),O=t.splice(0,1),n=E.defer(),c=R[O]||[];return e(n,[].concat(c),t),n.promise}}}]); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/css/reset.css: -------------------------------------------------------------------------------- 1 | a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0} -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/css/style.css: -------------------------------------------------------------------------------- 1 | .swagger-section #header a#logo{font-size:1.5em;font-weight:700;text-decoration:none;background:transparent url(../images/logo.png) no-repeat 0;padding:20px 0 20px 40px}#text-head{font-size:80px;font-family:Roboto,sans-serif;color:#fff;float:right;margin-right:20%}.navbar-fixed-top .navbar-brand,.navbar-fixed-top .navbar-nav,.navbar-header{height:auto}.navbar-inverse{background-color:#000;border-color:#000}#navbar-brand{margin-left:20%}.navtext{font-size:10px}.h1,h1{font-size:60px}.navbar-default .navbar-header .navbar-brand{color:#a2dfee}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#393939;font-family:Arvo,serif;font-size:1.5em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#525252;padding-left:0;display:block;clear:none;float:left;font-family:Arvo,serif;font-weight:700}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#0a0a0a}.container1{width:1500px;margin:auto;margin-top:0;background-image:url(../images/shield.png);background-repeat:no-repeat;background-position:-40px -20px;margin-bottom:210px}.container-inner{width:1200px;margin:auto;background-color:hsla(192,8%,88%,.75);padding-bottom:40px;padding-top:40px;border-radius:15px}.header-content{padding:0;width:1000px}.title1{font-size:80px;font-family:Vollkorn,serif;color:#404040;text-align:center;padding-top:40px;padding-bottom:100px}#icon{margin-top:-18px}.subtext{font-size:25px;font-style:italic;color:#08b;text-align:right;padding-right:250px}.bg-primary{background-color:#00468b}.navbar-default .nav>li>a,.navbar-default .nav>li>a:focus,.navbar-default .nav>li>a:focus:hover,.navbar-default .nav>li>a:hover{color:#08b}.text-faded{font-size:25px;font-family:Vollkorn,serif}.section-heading{font-family:Vollkorn,serif;font-size:45px;padding-bottom:10px}hr{border-color:#00468b;padding-bottom:10px}.description{margin-top:20px;padding-bottom:200px}.description li{font-family:Vollkorn,serif;font-size:25px;color:#525252;margin-left:28%;padding-top:5px}.gap{margin-top:200px}.troubleshootingtext{color:hsla(0,0%,100%,.7);padding-left:30%}.troubleshootingtext li{list-style-type:circle;font-size:25px;padding-bottom:5px}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}.block.response_body.json:hover{cursor:pointer}.backdrop{color:blue}#myModal{height:100%}.modal-backdrop{bottom:0;position:fixed}.curl{padding:10px;font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em;max-height:400px;margin-top:5px;overflow-y:auto;background-color:#fcf6db;border:1px solid #e5e0c6;border-radius:4px}.curl_title{font-size:1.1em;margin:0;padding:15px 0 5px;font-family:Open Sans,Helvetica Neue,Arial,sans-serif;font-weight:500;line-height:1.1}.footer{display:none}.swagger-section .swagger-ui-wrap h2{padding:0}h2{margin:0;margin-bottom:5px}.markdown p,.swagger-section .swagger-ui-wrap .code{font-size:15px;font-family:Arvo,serif}.swagger-section .swagger-ui-wrap b{font-family:Arvo,serif}#signin:hover{cursor:pointer}.dropdown-menu{padding:15px}.navbar-right .dropdown-menu{left:0;right:auto}#signinbutton{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b}.navbar-default .nav>li .details{color:#000;text-transform:none;font-size:15px;font-weight:400;font-family:Open Sans,sans-serif;font-style:italic;line-height:20px;top:-2px}.navbar-default .nav>li .details:hover{color:#000}#signout{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b} -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/css/typography.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/css/typography.css -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/fonts/DroidSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/fonts/DroidSans-Bold.ttf -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/collapse.gif -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/expand.gif -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/explorer_icons.png -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/favicon-16x16.png -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/favicon-32x32.png -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/favicon.ico -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/logo_small.png -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/pet_store_api.png -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/throbber.gif -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/images/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/swagger_proxy/vendors/dist_normal/images/wordnik_api.png -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/ca.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertència: Obsolet", 6 | "Implementation Notes":"Notes d'implementació", 7 | "Response Class":"Classe de la Resposta", 8 | "Status":"Estatus", 9 | "Parameters":"Paràmetres", 10 | "Parameter":"Paràmetre", 11 | "Value":"Valor", 12 | "Description":"Descripció", 13 | "Parameter Type":"Tipus del Paràmetre", 14 | "Data Type":"Tipus de la Dada", 15 | "Response Messages":"Missatges de la Resposta", 16 | "HTTP Status Code":"Codi d'Estatus HTTP", 17 | "Reason":"Raó", 18 | "Response Model":"Model de la Resposta", 19 | "Request URL":"URL de la Sol·licitud", 20 | "Response Body":"Cos de la Resposta", 21 | "Response Code":"Codi de la Resposta", 22 | "Response Headers":"Capçaleres de la Resposta", 23 | "Hide Response":"Amagar Resposta", 24 | "Try it out!":"Prova-ho!", 25 | "Show/Hide":"Mostrar/Amagar", 26 | "List Operations":"Llista Operacions", 27 | "Expand Operations":"Expandir Operacions", 28 | "Raw":"Cru", 29 | "can't parse JSON. Raw result":"no puc analitzar el JSON. Resultat cru", 30 | "Example Value":"Valor d'Exemple", 31 | "Model Schema":"Esquema del Model", 32 | "Model":"Model", 33 | "apply":"aplicar", 34 | "Username":"Nom d'usuari", 35 | "Password":"Contrasenya", 36 | "Terms of service":"Termes del servei", 37 | "Created by":"Creat per", 38 | "See more at":"Veure més en", 39 | "Contact the developer":"Contactar amb el desenvolupador", 40 | "api version":"versió de la api", 41 | "Response Content Type":"Tipus de Contingut de la Resposta", 42 | "fetching resource":"recollint recurs", 43 | "fetching resource list":"recollins llista de recursos", 44 | "Explore":"Explorant", 45 | "Show Swagger Petstore Example Apis":"Mostrar API d'Exemple Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No es pot llegir del servidor. Potser no teniu la configuració de control d'accés apropiada.", 47 | "Please specify the protocol for":"Si us plau, especifiqueu el protocol per a", 48 | "Can't read swagger JSON from":"No es pot llegir el JSON de swagger des de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalitzada la càrrega del recurs informatiu. Renderitzant Swagger UI", 50 | "Unable to read api":"No es pot llegir l'api", 51 | "from path":"des de la ruta", 52 | "server returned":"el servidor ha retornat" 53 | }); 54 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/el.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Προειδοποίηση: Έχει αποσυρθεί", 6 | "Implementation Notes":"Σημειώσεις Υλοποίησης", 7 | "Response Class":"Απόκριση", 8 | "Status":"Κατάσταση", 9 | "Parameters":"Παράμετροι", 10 | "Parameter":"Παράμετρος", 11 | "Value":"Τιμή", 12 | "Description":"Περιγραφή", 13 | "Parameter Type":"Τύπος Παραμέτρου", 14 | "Data Type":"Τύπος Δεδομένων", 15 | "Response Messages":"Μηνύματα Απόκρισης", 16 | "HTTP Status Code":"Κωδικός Κατάστασης HTTP", 17 | "Reason":"Αιτιολογία", 18 | "Response Model":"Μοντέλο Απόκρισης", 19 | "Request URL":"URL Αιτήματος", 20 | "Response Body":"Σώμα Απόκρισης", 21 | "Response Code":"Κωδικός Απόκρισης", 22 | "Response Headers":"Επικεφαλίδες Απόκρισης", 23 | "Hide Response":"Απόκρυψη Απόκρισης", 24 | "Headers":"Επικεφαλίδες", 25 | "Try it out!":"Δοκιμάστε το!", 26 | "Show/Hide":"Εμφάνιση/Απόκρυψη", 27 | "List Operations":"Λίστα Λειτουργιών", 28 | "Expand Operations":"Ανάπτυξη Λειτουργιών", 29 | "Raw":"Ακατέργαστο", 30 | "can't parse JSON. Raw result":"αδυναμία ανάλυσης JSON. Ακατέργαστο αποτέλεσμα", 31 | "Example Value":"Παράδειγμα Τιμής", 32 | "Model Schema":"Σχήμα Μοντέλου", 33 | "Model":"Μοντέλο", 34 | "Click to set as parameter value":"Πατήστε για να θέσετε τιμή παραμέτρου", 35 | "apply":"εφαρμογή", 36 | "Username":"Όνομα χρήση", 37 | "Password":"Κωδικός πρόσβασης", 38 | "Terms of service":"Όροι χρήσης", 39 | "Created by":"Δημιουργήθηκε από", 40 | "See more at":"Δείτε περισσότερα στο", 41 | "Contact the developer":"Επικοινωνήστε με τον προγραμματιστή", 42 | "api version":"έκδοση api", 43 | "Response Content Type":"Τύπος Περιεχομένου Απόκρισης", 44 | "Parameter content type:":"Τύπος περιεχομένου παραμέτρου:", 45 | "fetching resource":"παραλαβή πόρου", 46 | "fetching resource list":"παραλαβή λίστας πόρων", 47 | "Explore":"Εξερεύνηση", 48 | "Show Swagger Petstore Example Apis":"Εμφάνιση Api Δειγμάτων Petstore του Swagger", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Αδυναμία ανάγνωσης από τον εξυπηρετητή. Μπορεί να μην έχει κατάλληλες ρυθμίσεις για access-control-origin.", 50 | "Please specify the protocol for":"Παρακαλώ προσδιορίστε το πρωτόκολλο για", 51 | "Can't read swagger JSON from":"Αδυναμία ανάγνωσης swagger JSON από", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Ολοκλήρωση Φόρτωσης Πληροφορικών Πόρου. Παρουσίαση Swagger UI", 53 | "Unable to read api":"Αδυναμία ανάγνωσης api", 54 | "from path":"από το μονοπάτι", 55 | "server returned":"ο εξυπηρετηρής επέστρεψε" 56 | }); 57 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/en.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Warning: Deprecated", 6 | "Implementation Notes":"Implementation Notes", 7 | "Response Class":"Response Class", 8 | "Status":"Status", 9 | "Parameters":"Parameters", 10 | "Parameter":"Parameter", 11 | "Value":"Value", 12 | "Description":"Description", 13 | "Parameter Type":"Parameter Type", 14 | "Data Type":"Data Type", 15 | "Response Messages":"Response Messages", 16 | "HTTP Status Code":"HTTP Status Code", 17 | "Reason":"Reason", 18 | "Response Model":"Response Model", 19 | "Request URL":"Request URL", 20 | "Response Body":"Response Body", 21 | "Response Code":"Response Code", 22 | "Response Headers":"Response Headers", 23 | "Hide Response":"Hide Response", 24 | "Headers":"Headers", 25 | "Try it out!":"Try it out!", 26 | "Show/Hide":"Show/Hide", 27 | "List Operations":"List Operations", 28 | "Expand Operations":"Expand Operations", 29 | "Raw":"Raw", 30 | "can't parse JSON. Raw result":"can't parse JSON. Raw result", 31 | "Example Value":"Example Value", 32 | "Model Schema":"Model Schema", 33 | "Model":"Model", 34 | "Click to set as parameter value":"Click to set as parameter value", 35 | "apply":"apply", 36 | "Username":"Username", 37 | "Password":"Password", 38 | "Terms of service":"Terms of service", 39 | "Created by":"Created by", 40 | "See more at":"See more at", 41 | "Contact the developer":"Contact the developer", 42 | "api version":"api version", 43 | "Response Content Type":"Response Content Type", 44 | "Parameter content type:":"Parameter content type:", 45 | "fetching resource":"fetching resource", 46 | "fetching resource list":"fetching resource list", 47 | "Explore":"Explore", 48 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.", 50 | "Please specify the protocol for":"Please specify the protocol for", 51 | "Can't read swagger JSON from":"Can't read swagger JSON from", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI", 53 | "Unable to read api":"Unable to read api", 54 | "from path":"from path", 55 | "server returned":"server returned" 56 | }); 57 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/es.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertencia: Obsoleto", 6 | "Implementation Notes":"Notas de implementación", 7 | "Response Class":"Clase de la Respuesta", 8 | "Status":"Status", 9 | "Parameters":"Parámetros", 10 | "Parameter":"Parámetro", 11 | "Value":"Valor", 12 | "Description":"Descripción", 13 | "Parameter Type":"Tipo del Parámetro", 14 | "Data Type":"Tipo del Dato", 15 | "Response Messages":"Mensajes de la Respuesta", 16 | "HTTP Status Code":"Código de Status HTTP", 17 | "Reason":"Razón", 18 | "Response Model":"Modelo de la Respuesta", 19 | "Request URL":"URL de la Solicitud", 20 | "Response Body":"Cuerpo de la Respuesta", 21 | "Response Code":"Código de la Respuesta", 22 | "Response Headers":"Encabezados de la Respuesta", 23 | "Hide Response":"Ocultar Respuesta", 24 | "Try it out!":"Pruébalo!", 25 | "Show/Hide":"Mostrar/Ocultar", 26 | "List Operations":"Listar Operaciones", 27 | "Expand Operations":"Expandir Operaciones", 28 | "Raw":"Crudo", 29 | "can't parse JSON. Raw result":"no puede parsear el JSON. Resultado crudo", 30 | "Example Value":"Valor de Ejemplo", 31 | "Model Schema":"Esquema del Modelo", 32 | "Model":"Modelo", 33 | "apply":"aplicar", 34 | "Username":"Nombre de usuario", 35 | "Password":"Contraseña", 36 | "Terms of service":"Términos de Servicio", 37 | "Created by":"Creado por", 38 | "See more at":"Ver más en", 39 | "Contact the developer":"Contactar al desarrollador", 40 | "api version":"versión de la api", 41 | "Response Content Type":"Tipo de Contenido (Content Type) de la Respuesta", 42 | "fetching resource":"buscando recurso", 43 | "fetching resource list":"buscando lista del recurso", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Mostrar Api Ejemplo de Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No se puede leer del servidor. Tal vez no tiene la configuración de control de acceso de origen (access-control-origin) apropiado.", 47 | "Please specify the protocol for":"Por favor, especificar el protocola para", 48 | "Can't read swagger JSON from":"No se puede leer el JSON de swagger desde", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalizada la carga del recurso de Información. Mostrando Swagger UI", 50 | "Unable to read api":"No se puede leer la api", 51 | "from path":"desde ruta", 52 | "server returned":"el servidor retornó" 53 | }); 54 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/fr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Avertissement : Obsolète", 6 | "Implementation Notes":"Notes d'implémentation", 7 | "Response Class":"Classe de la réponse", 8 | "Status":"Statut", 9 | "Parameters":"Paramètres", 10 | "Parameter":"Paramètre", 11 | "Value":"Valeur", 12 | "Description":"Description", 13 | "Parameter Type":"Type du paramètre", 14 | "Data Type":"Type de données", 15 | "Response Messages":"Messages de la réponse", 16 | "HTTP Status Code":"Code de statut HTTP", 17 | "Reason":"Raison", 18 | "Response Model":"Modèle de réponse", 19 | "Request URL":"URL appelée", 20 | "Response Body":"Corps de la réponse", 21 | "Response Code":"Code de la réponse", 22 | "Response Headers":"En-têtes de la réponse", 23 | "Hide Response":"Cacher la réponse", 24 | "Headers":"En-têtes", 25 | "Try it out!":"Testez !", 26 | "Show/Hide":"Afficher/Masquer", 27 | "List Operations":"Liste des opérations", 28 | "Expand Operations":"Développer les opérations", 29 | "Raw":"Brut", 30 | "can't parse JSON. Raw result":"impossible de décoder le JSON. Résultat brut", 31 | "Example Value":"Exemple la valeur", 32 | "Model Schema":"Définition du modèle", 33 | "Model":"Modèle", 34 | "apply":"appliquer", 35 | "Username":"Nom d'utilisateur", 36 | "Password":"Mot de passe", 37 | "Terms of service":"Conditions de service", 38 | "Created by":"Créé par", 39 | "See more at":"Voir plus sur", 40 | "Contact the developer":"Contacter le développeur", 41 | "api version":"version de l'api", 42 | "Response Content Type":"Content Type de la réponse", 43 | "fetching resource":"récupération de la ressource", 44 | "fetching resource list":"récupération de la liste de ressources", 45 | "Explore":"Explorer", 46 | "Show Swagger Petstore Example Apis":"Montrer les Apis de l'exemple Petstore de Swagger", 47 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Impossible de lire à partir du serveur. Il se peut que les réglages access-control-origin ne soient pas appropriés.", 48 | "Please specify the protocol for":"Veuillez spécifier un protocole pour", 49 | "Can't read swagger JSON from":"Impossible de lire le JSON swagger à partir de", 50 | "Finished Loading Resource Information. Rendering Swagger UI":"Chargement des informations terminé. Affichage de Swagger UI", 51 | "Unable to read api":"Impossible de lire l'api", 52 | "from path":"à partir du chemin", 53 | "server returned":"réponse du serveur" 54 | }); 55 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/geo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"ყურადღება: აღარ გამოიყენება", 6 | "Implementation Notes":"იმპლემენტაციის აღწერა", 7 | "Response Class":"რესპონს კლასი", 8 | "Status":"სტატუსი", 9 | "Parameters":"პარამეტრები", 10 | "Parameter":"პარამეტრი", 11 | "Value":"მნიშვნელობა", 12 | "Description":"აღწერა", 13 | "Parameter Type":"პარამეტრის ტიპი", 14 | "Data Type":"მონაცემის ტიპი", 15 | "Response Messages":"პასუხი", 16 | "HTTP Status Code":"HTTP სტატუსი", 17 | "Reason":"მიზეზი", 18 | "Response Model":"რესპონს მოდელი", 19 | "Request URL":"მოთხოვნის URL", 20 | "Response Body":"პასუხის სხეული", 21 | "Response Code":"პასუხის კოდი", 22 | "Response Headers":"პასუხის ჰედერები", 23 | "Hide Response":"დამალე პასუხი", 24 | "Headers":"ჰედერები", 25 | "Try it out!":"ცადე !", 26 | "Show/Hide":"გამოჩენა/დამალვა", 27 | "List Operations":"ოპერაციების სია", 28 | "Expand Operations":"ოპერაციები ვრცლად", 29 | "Raw":"ნედლი", 30 | "can't parse JSON. Raw result":"JSON-ის დამუშავება ვერ მოხერხდა. ნედლი პასუხი", 31 | "Example Value":"მაგალითი", 32 | "Model Schema":"მოდელის სტრუქტურა", 33 | "Model":"მოდელი", 34 | "Click to set as parameter value":"პარამეტრისთვის მნიშვნელობის მისანიჭებლად, დააკლიკე", 35 | "apply":"გამოყენება", 36 | "Username":"მოხმარებელი", 37 | "Password":"პაროლი", 38 | "Terms of service":"მომსახურების პირობები", 39 | "Created by":"შექმნა", 40 | "See more at":"ნახე ვრცლად", 41 | "Contact the developer":"დაუკავშირდი დეველოპერს", 42 | "api version":"api ვერსია", 43 | "Response Content Type":"პასუხის კონტენტის ტიპი", 44 | "Parameter content type:":"პარამეტრის კონტენტის ტიპი:", 45 | "fetching resource":"რესურსების მიღება", 46 | "fetching resource list":"რესურსების სიის მიღება", 47 | "Explore":"ნახვა", 48 | "Show Swagger Petstore Example Apis":"ნახე Swagger Petstore სამაგალითო Api", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"სერვერთან დაკავშირება ვერ ხერხდება. შეამოწმეთ access-control-origin.", 50 | "Please specify the protocol for":"მიუთითეთ პროტოკოლი", 51 | "Can't read swagger JSON from":"swagger JSON წაკითხვა ვერ მოხერხდა", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"რესურსების ჩატვირთვა სრულდება. Swagger UI რენდერდება", 53 | "Unable to read api":"api წაკითხვა ვერ მოხერხდა", 54 | "from path":"მისამართიდან", 55 | "server returned":"სერვერმა დააბრუნა" 56 | }); 57 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/it.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Attenzione: Deprecato", 6 | "Implementation Notes":"Note di implementazione", 7 | "Response Class":"Classe della risposta", 8 | "Status":"Stato", 9 | "Parameters":"Parametri", 10 | "Parameter":"Parametro", 11 | "Value":"Valore", 12 | "Description":"Descrizione", 13 | "Parameter Type":"Tipo di parametro", 14 | "Data Type":"Tipo di dato", 15 | "Response Messages":"Messaggi della risposta", 16 | "HTTP Status Code":"Codice stato HTTP", 17 | "Reason":"Motivo", 18 | "Response Model":"Modello di risposta", 19 | "Request URL":"URL della richiesta", 20 | "Response Body":"Corpo della risposta", 21 | "Response Code":"Oggetto della risposta", 22 | "Response Headers":"Intestazioni della risposta", 23 | "Hide Response":"Nascondi risposta", 24 | "Try it out!":"Provalo!", 25 | "Show/Hide":"Mostra/Nascondi", 26 | "List Operations":"Mostra operazioni", 27 | "Expand Operations":"Espandi operazioni", 28 | "Raw":"Grezzo (raw)", 29 | "can't parse JSON. Raw result":"non è possibile parsare il JSON. Risultato grezzo (raw).", 30 | "Model Schema":"Schema del modello", 31 | "Model":"Modello", 32 | "apply":"applica", 33 | "Username":"Nome utente", 34 | "Password":"Password", 35 | "Terms of service":"Condizioni del servizio", 36 | "Created by":"Creato da", 37 | "See more at":"Informazioni aggiuntive:", 38 | "Contact the developer":"Contatta lo sviluppatore", 39 | "api version":"versione api", 40 | "Response Content Type":"Tipo di contenuto (content type) della risposta", 41 | "fetching resource":"recuperando la risorsa", 42 | "fetching resource list":"recuperando lista risorse", 43 | "Explore":"Esplora", 44 | "Show Swagger Petstore Example Apis":"Mostra le api di esempio di Swagger Petstore", 45 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Non è possibile leggere dal server. Potrebbe non avere le impostazioni di controllo accesso origine (access-control-origin) appropriate.", 46 | "Please specify the protocol for":"Si prega di specificare il protocollo per", 47 | "Can't read swagger JSON from":"Impossibile leggere JSON swagger da:", 48 | "Finished Loading Resource Information. Rendering Swagger UI":"Lettura informazioni risorse termianta. Swagger UI viene mostrata", 49 | "Unable to read api":"Impossibile leggere la api", 50 | "from path":"da cartella", 51 | "server returned":"il server ha restituito" 52 | }); 53 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/ja.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告: 廃止予定", 6 | "Implementation Notes":"実装メモ", 7 | "Response Class":"レスポンスクラス", 8 | "Status":"ステータス", 9 | "Parameters":"パラメータ群", 10 | "Parameter":"パラメータ", 11 | "Value":"値", 12 | "Description":"説明", 13 | "Parameter Type":"パラメータタイプ", 14 | "Data Type":"データタイプ", 15 | "Response Messages":"レスポンスメッセージ", 16 | "HTTP Status Code":"HTTPステータスコード", 17 | "Reason":"理由", 18 | "Response Model":"レスポンスモデル", 19 | "Request URL":"リクエストURL", 20 | "Response Body":"レスポンスボディ", 21 | "Response Code":"レスポンスコード", 22 | "Response Headers":"レスポンスヘッダ", 23 | "Hide Response":"レスポンスを隠す", 24 | "Headers":"ヘッダ", 25 | "Try it out!":"実際に実行!", 26 | "Show/Hide":"表示/非表示", 27 | "List Operations":"操作一覧", 28 | "Expand Operations":"操作の展開", 29 | "Raw":"未加工", 30 | "can't parse JSON. Raw result":"JSONへ解釈できません. 未加工の結果", 31 | "Example Value":"値の例", 32 | "Model Schema":"モデルスキーマ", 33 | "Model":"モデル", 34 | "Click to set as parameter value":"パラメータ値と設定するにはクリック", 35 | "apply":"実行", 36 | "Username":"ユーザ名", 37 | "Password":"パスワード", 38 | "Terms of service":"サービス利用規約", 39 | "Created by":"Created by", 40 | "See more at":"詳細を見る", 41 | "Contact the developer":"開発者に連絡", 42 | "api version":"APIバージョン", 43 | "Response Content Type":"レスポンス コンテンツタイプ", 44 | "Parameter content type:":"パラメータコンテンツタイプ:", 45 | "fetching resource":"リソースの取得", 46 | "fetching resource list":"リソース一覧の取得", 47 | "Explore":"調査", 48 | "Show Swagger Petstore Example Apis":"SwaggerペットストアAPIの表示", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"サーバから読み込めません. 適切なaccess-control-origin設定を持っていない可能性があります.", 50 | "Please specify the protocol for":"プロトコルを指定してください", 51 | "Can't read swagger JSON from":"次からswagger JSONを読み込めません", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"リソース情報の読み込みが完了しました. Swagger UIを描画しています", 53 | "Unable to read api":"APIを読み込めません", 54 | "from path":"次のパスから", 55 | "server returned":"サーバからの返答" 56 | }); 57 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/ko-kr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"경고:폐기예정됨", 6 | "Implementation Notes":"구현 노트", 7 | "Response Class":"응답 클래스", 8 | "Status":"상태", 9 | "Parameters":"매개변수들", 10 | "Parameter":"매개변수", 11 | "Value":"값", 12 | "Description":"설명", 13 | "Parameter Type":"매개변수 타입", 14 | "Data Type":"데이터 타입", 15 | "Response Messages":"응답 메세지", 16 | "HTTP Status Code":"HTTP 상태 코드", 17 | "Reason":"원인", 18 | "Response Model":"응답 모델", 19 | "Request URL":"요청 URL", 20 | "Response Body":"응답 본문", 21 | "Response Code":"응답 코드", 22 | "Response Headers":"응답 헤더", 23 | "Hide Response":"응답 숨기기", 24 | "Headers":"헤더", 25 | "Try it out!":"써보기!", 26 | "Show/Hide":"보이기/숨기기", 27 | "List Operations":"목록 작업", 28 | "Expand Operations":"전개 작업", 29 | "Raw":"원본", 30 | "can't parse JSON. Raw result":"JSON을 파싱할수 없음. 원본결과:", 31 | "Model Schema":"모델 스키마", 32 | "Model":"모델", 33 | "apply":"적용", 34 | "Username":"사용자 이름", 35 | "Password":"암호", 36 | "Terms of service":"이용약관", 37 | "Created by":"작성자", 38 | "See more at":"추가정보:", 39 | "Contact the developer":"개발자에게 문의", 40 | "api version":"api버전", 41 | "Response Content Type":"응답Content Type", 42 | "fetching resource":"리소스 가져오기", 43 | "fetching resource list":"리소스 목록 가져오기", 44 | "Explore":"탐색", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore 예제 보기", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"서버로부터 읽어들일수 없습니다. access-control-origin 설정이 올바르지 않을수 있습니다.", 47 | "Please specify the protocol for":"다음을 위한 프로토콜을 정하세요", 48 | "Can't read swagger JSON from":"swagger JSON 을 다음으로 부터 읽을수 없습니다", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"리소스 정보 불러오기 완료. Swagger UI 랜더링", 50 | "Unable to read api":"api를 읽을 수 없습니다.", 51 | "from path":"다음 경로로 부터", 52 | "server returned":"서버 응답함." 53 | }); 54 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/pl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uwaga: Wycofane", 6 | "Implementation Notes":"Uwagi Implementacji", 7 | "Response Class":"Klasa Odpowiedzi", 8 | "Status":"Status", 9 | "Parameters":"Parametry", 10 | "Parameter":"Parametr", 11 | "Value":"Wartość", 12 | "Description":"Opis", 13 | "Parameter Type":"Typ Parametru", 14 | "Data Type":"Typ Danych", 15 | "Response Messages":"Wiadomości Odpowiedzi", 16 | "HTTP Status Code":"Kod Statusu HTTP", 17 | "Reason":"Przyczyna", 18 | "Response Model":"Model Odpowiedzi", 19 | "Request URL":"URL Wywołania", 20 | "Response Body":"Treść Odpowiedzi", 21 | "Response Code":"Kod Odpowiedzi", 22 | "Response Headers":"Nagłówki Odpowiedzi", 23 | "Hide Response":"Ukryj Odpowiedź", 24 | "Headers":"Nagłówki", 25 | "Try it out!":"Wypróbuj!", 26 | "Show/Hide":"Pokaż/Ukryj", 27 | "List Operations":"Lista Operacji", 28 | "Expand Operations":"Rozwiń Operacje", 29 | "Raw":"Nieprzetworzone", 30 | "can't parse JSON. Raw result":"nie można przetworzyć pliku JSON. Nieprzetworzone dane", 31 | "Model Schema":"Schemat Modelu", 32 | "Model":"Model", 33 | "apply":"użyj", 34 | "Username":"Nazwa użytkownika", 35 | "Password":"Hasło", 36 | "Terms of service":"Warunki używania", 37 | "Created by":"Utworzone przez", 38 | "See more at":"Zobacz więcej na", 39 | "Contact the developer":"Kontakt z deweloperem", 40 | "api version":"wersja api", 41 | "Response Content Type":"Typ Zasobu Odpowiedzi", 42 | "fetching resource":"ładowanie zasobu", 43 | "fetching resource list":"ładowanie listy zasobów", 44 | "Explore":"Eksploruj", 45 | "Show Swagger Petstore Example Apis":"Pokaż Przykładowe Api Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Brak połączenia z serwerem. Może on nie mieć odpowiednich ustawień access-control-origin.", 47 | "Please specify the protocol for":"Proszę podać protokół dla", 48 | "Can't read swagger JSON from":"Nie można odczytać swagger JSON z", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Ukończono Ładowanie Informacji o Zasobie. Renderowanie Swagger UI", 50 | "Unable to read api":"Nie można odczytać api", 51 | "from path":"ze ścieżki", 52 | "server returned":"serwer zwrócił" 53 | }); 54 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/pt.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Aviso: Depreciado", 6 | "Implementation Notes":"Notas de Implementação", 7 | "Response Class":"Classe de resposta", 8 | "Status":"Status", 9 | "Parameters":"Parâmetros", 10 | "Parameter":"Parâmetro", 11 | "Value":"Valor", 12 | "Description":"Descrição", 13 | "Parameter Type":"Tipo de parâmetro", 14 | "Data Type":"Tipo de dados", 15 | "Response Messages":"Mensagens de resposta", 16 | "HTTP Status Code":"Código de status HTTP", 17 | "Reason":"Razão", 18 | "Response Model":"Modelo resposta", 19 | "Request URL":"URL requisição", 20 | "Response Body":"Corpo da resposta", 21 | "Response Code":"Código da resposta", 22 | "Response Headers":"Cabeçalho da resposta", 23 | "Headers":"Cabeçalhos", 24 | "Hide Response":"Esconder resposta", 25 | "Try it out!":"Tente agora!", 26 | "Show/Hide":"Mostrar/Esconder", 27 | "List Operations":"Listar operações", 28 | "Expand Operations":"Expandir operações", 29 | "Raw":"Cru", 30 | "can't parse JSON. Raw result":"Falha ao analisar JSON. Resulto cru", 31 | "Model Schema":"Modelo esquema", 32 | "Model":"Modelo", 33 | "apply":"Aplicar", 34 | "Username":"Usuário", 35 | "Password":"Senha", 36 | "Terms of service":"Termos do serviço", 37 | "Created by":"Criado por", 38 | "See more at":"Veja mais em", 39 | "Contact the developer":"Contate o desenvolvedor", 40 | "api version":"Versão api", 41 | "Response Content Type":"Tipo de conteúdo da resposta", 42 | "fetching resource":"busca recurso", 43 | "fetching resource list":"buscando lista de recursos", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Não é possível ler do servidor. Pode não ter as apropriadas configurações access-control-origin", 47 | "Please specify the protocol for":"Por favor especifique o protocolo", 48 | "Can't read swagger JSON from":"Não é possível ler o JSON Swagger de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Carregar informação de recurso finalizada. Renderizando Swagger UI", 50 | "Unable to read api":"Não foi possível ler api", 51 | "from path":"do caminho", 52 | "server returned":"servidor retornou" 53 | }); 54 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/ru.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Предупреждение: Устарело", 6 | "Implementation Notes":"Заметки", 7 | "Response Class":"Пример ответа", 8 | "Status":"Статус", 9 | "Parameters":"Параметры", 10 | "Parameter":"Параметр", 11 | "Value":"Значение", 12 | "Description":"Описание", 13 | "Parameter Type":"Тип параметра", 14 | "Data Type":"Тип данных", 15 | "HTTP Status Code":"HTTP код", 16 | "Reason":"Причина", 17 | "Response Model":"Структура ответа", 18 | "Request URL":"URL запроса", 19 | "Response Body":"Тело ответа", 20 | "Response Code":"HTTP код ответа", 21 | "Response Headers":"Заголовки ответа", 22 | "Hide Response":"Спрятать ответ", 23 | "Headers":"Заголовки", 24 | "Response Messages":"Что может прийти в ответ", 25 | "Try it out!":"Попробовать!", 26 | "Show/Hide":"Показать/Скрыть", 27 | "List Operations":"Операции кратко", 28 | "Expand Operations":"Операции подробно", 29 | "Raw":"В сыром виде", 30 | "can't parse JSON. Raw result":"Не удается распарсить ответ:", 31 | "Example Value":"Пример", 32 | "Model Schema":"Структура", 33 | "Model":"Описание", 34 | "Click to set as parameter value":"Нажмите, чтобы испльзовать в качестве значения параметра", 35 | "apply":"применить", 36 | "Username":"Имя пользователя", 37 | "Password":"Пароль", 38 | "Terms of service":"Условия использования", 39 | "Created by":"Разработано", 40 | "See more at":"Еще тут", 41 | "Contact the developer":"Связаться с разработчиком", 42 | "api version":"Версия API", 43 | "Response Content Type":"Content Type ответа", 44 | "Parameter content type:":"Content Type параметра:", 45 | "fetching resource":"Получение ресурса", 46 | "fetching resource list":"Получение ресурсов", 47 | "Explore":"Показать", 48 | "Show Swagger Petstore Example Apis":"Показать примеры АПИ", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, проблема с настройками доступа", 50 | "Please specify the protocol for":"Пожалуйста, укажите протокол для", 51 | "Can't read swagger JSON from":"Не получается прочитать swagger json из", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим", 53 | "Unable to read api":"Не удалось прочитать api", 54 | "from path":"по адресу", 55 | "server returned":"сервер сказал" 56 | }); 57 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/tr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uyarı: Deprecated", 6 | "Implementation Notes":"Gerçekleştirim Notları", 7 | "Response Class":"Dönen Sınıf", 8 | "Status":"Statü", 9 | "Parameters":"Parametreler", 10 | "Parameter":"Parametre", 11 | "Value":"Değer", 12 | "Description":"Açıklama", 13 | "Parameter Type":"Parametre Tipi", 14 | "Data Type":"Veri Tipi", 15 | "Response Messages":"Dönüş Mesajı", 16 | "HTTP Status Code":"HTTP Statü Kodu", 17 | "Reason":"Gerekçe", 18 | "Response Model":"Dönüş Modeli", 19 | "Request URL":"İstek URL", 20 | "Response Body":"Dönüş İçeriği", 21 | "Response Code":"Dönüş Kodu", 22 | "Response Headers":"Dönüş Üst Bilgileri", 23 | "Hide Response":"Dönüşü Gizle", 24 | "Headers":"Üst Bilgiler", 25 | "Try it out!":"Dene!", 26 | "Show/Hide":"Göster/Gizle", 27 | "List Operations":"Operasyonları Listele", 28 | "Expand Operations":"Operasyonları Aç", 29 | "Raw":"Ham", 30 | "can't parse JSON. Raw result":"JSON çözümlenemiyor. Ham sonuç", 31 | "Model Schema":"Model Şema", 32 | "Model":"Model", 33 | "apply":"uygula", 34 | "Username":"Kullanıcı Adı", 35 | "Password":"Parola", 36 | "Terms of service":"Servis şartları", 37 | "Created by":"Oluşturan", 38 | "See more at":"Daha fazlası için", 39 | "Contact the developer":"Geliştirici ile İletişime Geçin", 40 | "api version":"api versiyon", 41 | "Response Content Type":"Dönüş İçerik Tipi", 42 | "fetching resource":"kaynak getiriliyor", 43 | "fetching resource list":"kaynak listesi getiriliyor", 44 | "Explore":"Keşfet", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore Örnek Api'yi Gör", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Sunucudan okuma yapılamıyor. Sunucu access-control-origin ayarlarınızı kontrol edin.", 47 | "Please specify the protocol for":"Lütfen istenen adres için protokol belirtiniz", 48 | "Can't read swagger JSON from":"Swagger JSON bu kaynaktan okunamıyor", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Kaynak baglantısı tamamlandı. Swagger UI gösterime hazırlanıyor", 50 | "Unable to read api":"api okunamadı", 51 | "from path":"yoldan", 52 | "server returned":"sunucuya dönüldü" 53 | }); 54 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/translator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Translator for documentation pages. 5 | * 6 | * To enable translation you should include one of language-files in your index.html 7 | * after . 8 | * For example - 9 | * 10 | * If you wish to translate some new texts you should do two things: 11 | * 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too. 12 | * 2. Mark that text it templates this way New Phrase or . 13 | * The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate. 14 | * 15 | */ 16 | window.SwaggerTranslator = { 17 | 18 | _words:[], 19 | 20 | translate: function(sel) { 21 | var $this = this; 22 | sel = sel || '[data-sw-translate]'; 23 | 24 | $(sel).each(function() { 25 | $(this).html($this._tryTranslate($(this).html())); 26 | 27 | $(this).val($this._tryTranslate($(this).val())); 28 | $(this).attr('title', $this._tryTranslate($(this).attr('title'))); 29 | }); 30 | }, 31 | 32 | _tryTranslate: function(word) { 33 | return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; 34 | }, 35 | 36 | learn: function(wordsMap) { 37 | this._words = wordsMap; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lang/zh-cn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告:已过时", 6 | "Implementation Notes":"说明", 7 | "Response Class":"响应类", 8 | "Status":"状态", 9 | "Parameters":"参数", 10 | "Parameter":"参数", 11 | "Value":"值", 12 | "Description":"描述", 13 | "Parameter Type":"参数类型", 14 | "Data Type":"数据类型", 15 | "Response Messages":"响应消息", 16 | "HTTP Status Code":"HTTP状态码", 17 | "Reason":"原因", 18 | "Response Model":"响应模型", 19 | "Request URL":"请求地址", 20 | "Request Headers":"请求头", 21 | "Response Body":"响应体", 22 | "Response Code":"响应码", 23 | "Response Headers":"响应头", 24 | "Hide Response":"隐藏响应", 25 | "Headers":"头", 26 | "Try it out!":"试一下!", 27 | "Show/Hide":"显示/隐藏", 28 | "List Operations":"显示操作", 29 | "Expand Operations":"展开操作", 30 | "Raw":"原始", 31 | "can't parse JSON. Raw result":"无法解析JSON. 原始结果", 32 | "Example Value":"示例", 33 | "Click to set as parameter value":"点击设置参数", 34 | "Model Schema":"模型架构", 35 | "Model":"模型", 36 | "apply":"应用", 37 | "Username":"用户名", 38 | "Password":"密码", 39 | "Terms of service":"服务条款", 40 | "Created by":"创建者", 41 | "See more at":"查看更多:", 42 | "Contact the developer":"联系开发者", 43 | "api version":"api版本", 44 | "Response Content Type":"响应Content Type", 45 | "Parameter content type:":"参数类型:", 46 | "fetching resource":"正在获取资源", 47 | "fetching resource list":"正在获取资源列表", 48 | "Explore":"浏览", 49 | "Show Swagger Petstore Example Apis":"显示 Swagger Petstore 示例 Apis", 50 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"无法从服务器读取。可能没有正确设置access-control-origin。", 51 | "Please specify the protocol for":"请指定协议:", 52 | "Can't read swagger JSON from":"无法读取swagger JSON于", 53 | "Finished Loading Resource Information. Rendering Swagger UI":"已加载资源信息。正在渲染Swagger UI", 54 | "Unable to read api":"无法读取api", 55 | "from path":"从路径", 56 | "server returned":"服务器返回" 57 | }); 58 | -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lib/highlight.9.1.0.pack_extended.js: -------------------------------------------------------------------------------- 1 | "use strict";!function(){var h,l;h=hljs.configure,hljs.configure=function(l){var i=l.highlightSizeThreshold;hljs.highlightSizeThreshold=i===+i?i:null,h.call(this,l)},l=hljs.highlightBlock,hljs.highlightBlock=function(h){var i=h.innerHTML,g=hljs.highlightSizeThreshold;(null==g||g>i.length)&&l.call(hljs,h)}}(); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lib/jquery.ba-bbq.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){function n(e){return"string"==typeof e}function r(e){var t=g.call(arguments,1);return function(){return e.apply(this,t.concat(g.call(arguments)))}}function o(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}function a(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function i(r,o,a,i,c){var u,s,p,h,d;return i!==f?(p=a.match(r?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/),d=p[3]||"",2===c&&n(i)?s=i.replace(r?R:E,""):(h=l(p[2]),i=n(i)?l[r?A:w](i):i,s=2===c?i:1===c?e.extend({},i,h):e.extend({},h,i),s=b(s),r&&(s=s.replace(m,y))),u=p[1]+(r?"#":s||!p[1]?"?":"")+s+d):u=o(a!==f?a:t[S][q]),u}function c(e,t,r){return t===f||"boolean"==typeof t?(r=t,t=b[e?A:w]()):t=n(t)?t.replace(e?R:E,""):t,l(t,r)}function u(t,r,o,a){return n(o)||"object"==typeof o||(a=o,o=r,r=f),this.each(function(){var n=e(this),i=r||v()[(this.nodeName||"").toLowerCase()]||"",c=i&&n.attr(i)||"";n.attr(i,b[t](c,o,a))})}var f,s,l,p,h,d,v,m,g=Array.prototype.slice,y=decodeURIComponent,b=e.param,$=e.bbq=e.bbq||{},x=e.event.special,j="hashchange",w="querystring",A="fragment",N="elemUrlAttr",S="location",q="href",C="src",E=/^.*\?|#.*$/g,R=/^.*\#/,U={};b[w]=r(i,0,a),b[A]=s=r(i,1,o),s.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);m=new RegExp(n.join("|"),"g")},s.noEscape(",/"),e.deparam=l=function(t,n){var r={},o={"true":!0,"false":!1,"null":null};return e.each(t.replace(/\+/g," ").split("&"),function(t,a){var i,c=a.split("="),u=y(c[0]),s=r,l=0,p=u.split("]["),h=p.length-1;if(/\[/.test(p[0])&&/\]$/.test(p[h])?(p[h]=p[h].replace(/\]$/,""),p=p.shift().split("[").concat(p),h=p.length-1):h=0,2===c.length)if(i=y(c[1]),n&&(i=i&&!isNaN(i)?+i:"undefined"===i?f:o[i]!==f?o[i]:i),h)for(;l<=h;l++)u=""===p[l]?s.length:p[l],s=s[u]=l').hide().insertAfter("body")[0].contentWindow,s=function(){return r(a.document[i][u])},(f=function(e,t){if(e!==t){var n=a.document;n.open().close(),n[i].hash="#"+e}})(r()))}var o,a,f,s,p={};return p.start=function(){if(!o){var a=r();f||n(),function l(){var n=r(),p=s(a);n!==a?(f(a=n,p),e(t).trigger(c)):p!==a&&(t[i][u]=t[i][u].replace(/#.*/,"")+"#"+p),o=setTimeout(l,e[c+"Delay"])}()}},p.stop=function(){a||(o&&clearTimeout(o),o=0)},p}()}(jQuery,this); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lib/jquery.slideto.min.js: -------------------------------------------------------------------------------- 1 | !function(i){i.fn.slideto=function(o){return o=i.extend({slide_duration:"slow",highlight_duration:3e3,highlight:!0,highlight_color:"#FFFF99"},o),this.each(function(){obj=i(this),i("body").animate({scrollTop:obj.offset().top},o.slide_duration,function(){o.highlight&&i.ui.version&&obj.effect("highlight",{color:o.highlight_color},o.highlight_duration)})})}}(jQuery); -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lib/jquery.wiggle.min.js: -------------------------------------------------------------------------------- 1 | jQuery.fn.wiggle=function(e){var a={speed:50,wiggles:3,travel:5,callback:null},e=jQuery.extend(a,e);return this.each(function(){var a=this,l=(jQuery(this).wrap('
').css("position","relative"),0);for(i=1;i<=e.wiggles;i++)jQuery(this).animate({left:"-="+e.travel},e.speed).animate({left:"+="+2*e.travel},2*e.speed).animate({left:"-="+e.travel},e.speed,function(){l++,jQuery(a).parent().hasClass("wiggle-wrap")&&jQuery(a).parent().replaceWith(a),l==e.wiggles&&jQuery.isFunction(e.callback)&&e.callback()})})}; -------------------------------------------------------------------------------- /falsy/swagger_proxy/vendors/dist_normal/lib/object-assign-pollyfill.js: -------------------------------------------------------------------------------- 1 | "function"!=typeof Object.assign&&!function(){Object.assign=function(n){"use strict";if(void 0===n||null===n)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(n),o=1;o 2 | var qp = null; 3 | if(window.location.hash && window.location.hash !== "#_=_") { 4 | qp = location.hash.substring(1); 5 | } 6 | else { 7 | qp = location.search.substring(1); 8 | } 9 | qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}', 10 | function(key, value) { 11 | return key===""?value:decodeURIComponent(value) } 12 | ):{} 13 | 14 | if (window.opener.swaggerUiAuth.tokenUrl) 15 | window.opener.processOAuthCode(qp); 16 | else 17 | window.opener.onOAuthComplete(qp); 18 | 19 | window.close(); 20 | 21 | -------------------------------------------------------------------------------- /falsy/termcc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/termcc/__init__.py -------------------------------------------------------------------------------- /falsy/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pingf/falsy/25d35bd76f10eefcdd3537e2321e5715228cdb5e/falsy/utils/__init__.py -------------------------------------------------------------------------------- /falsy/utils/decorator.py: -------------------------------------------------------------------------------- 1 | import time 2 | from contextlib import ContextDecorator 3 | 4 | from falsy.jlog.jlog import JLog 5 | from falsy.loader import func 6 | 7 | 8 | class redirect_exceptions(ContextDecorator): 9 | def __init__(self, **kwargs): 10 | self.__dict__.update(kwargs) 11 | 12 | def __enter__(self): 13 | return self 14 | 15 | def __exit__(self, e_type, e_value, e_trace): 16 | if e_type is None or e_value is None: 17 | return 18 | to = self.__dict__.get('to') 19 | if to: 20 | exceptions = self.__dict__.get('exceptions', ()) 21 | if issubclass(e_type, exceptions): 22 | propagate = func.load(to)(e_type, e_value, e_trace) 23 | if propagate in [True, False]: 24 | return propagate 25 | 26 | 27 | 28 | class log_runtime(ContextDecorator): 29 | def __init__(self, **kwargs): 30 | self.__dict__.update(kwargs) 31 | self.log = JLog().bind() 32 | 33 | def __enter__(self): 34 | self.start_time = time.time() 35 | return self 36 | 37 | def __exit__(self, typ, val, traceback): 38 | # Note: typ, val and traceback will only be not None 39 | # If an exception occured 40 | self.log.info("{}: {}".format(self.__dict__.get('label', 'default'), time.time() - self.start_time)) 41 | return False 42 | -------------------------------------------------------------------------------- /falsy/utils/marshmallow.py: -------------------------------------------------------------------------------- 1 | import functools 2 | 3 | from marshmallow import Schema 4 | 5 | 6 | def argmap2schema(argmap): 7 | class Meta(object): 8 | strict = True 9 | 10 | attrs = dict(argmap, Meta=Meta) 11 | CLS = type(str(''), (Schema,), attrs) 12 | return CLS() 13 | 14 | 15 | class MMException(Exception): 16 | pass 17 | 18 | 19 | def validate(argmap): 20 | schema = argmap2schema(argmap) 21 | 22 | def decorator(func): 23 | @functools.wraps(func) 24 | def decorated(*args, **kwargs): 25 | e = schema.validate(kwargs) 26 | if e: 27 | raise MMException(str(e)) 28 | return func(*args, **kwargs) 29 | 30 | return decorated 31 | 32 | return decorator 33 | 34 | 35 | def mm_check(routes, req, **kwargs): 36 | sig = req.spec['route_signature'] 37 | args = routes.get(sig) 38 | schema = argmap2schema(args) 39 | e = schema.validate(kwargs) 40 | if e: 41 | raise MMException(str(e)) 42 | -------------------------------------------------------------------------------- /falsy/utils/meta.py: -------------------------------------------------------------------------------- 1 | class Meta(dict): 2 | def __getattr__(self, name): 3 | try: 4 | return self[name] 5 | except KeyError: 6 | raise AttributeError(name) 7 | 8 | def __setattr__(self, name, value): 9 | self[name] = value 10 | 11 | def bind(self, name, func): 12 | setattr(self.__class__, name, func) 13 | 14 | 15 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | falcon 2 | PyYAML 3 | Jinja2 4 | gunicorn 5 | 6 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = falsy 3 | version = 2017.08.01 4 | summary = falcon.swagger.yaml 5 | author = Jesse MENG (dameng/pingf) 6 | author-email = pingf0@gmail.com 7 | requires-dist = 8 | falcon 9 | PyYAML 10 | Jinja2 11 | gunicorn 12 | classifier = 13 | License :: OSI Approved :: Apache Software License 14 | License :: OSI Approved :: MIT License 15 | Operating System :: POSIX :: Linux 16 | Programming Language :: Python :: 3 17 | Programming Language :: Python :: 3.4 18 | Programming Language :: Python :: 3.5 19 | Programming Language :: Python :: 3.6 20 | description-file = README.md 21 | url = https://github.com/pingf 22 | 23 | [files] 24 | packages = 25 | falsy 26 | 27 | 28 | [wheel] 29 | universal = 0 30 | 31 | 32 | 33 | [build_sphinx] 34 | all_files = 1 35 | build-dir = docs/_build 36 | source-dir = docs/ 37 | 38 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from glob import glob 2 | 3 | from pbr import util 4 | from setuptools import setup 5 | 6 | cfg = util.cfg_to_args() 7 | cfg.update({ 8 | 'data_files': [ 9 | ('docs', glob('docs/*.rst')) 10 | ], 11 | # 'pbr': True, 12 | 13 | }) 14 | setup( 15 | **cfg 16 | ) 17 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = build 3 | 4 | 5 | [testenv:build] 6 | basepython = 7 | {homedir}/.pyenv/versions/falconplus/bin/python3 8 | setenv = 9 | PYTHONHASHSEED = 0 10 | LC_ALL=en_US.utf-8 11 | LANG=en_US.utf-8 12 | deps = 13 | pbr 14 | -rrequirements.txt 15 | commands = 16 | /bin/echo 'just build it' 17 | 18 | --------------------------------------------------------------------------------