Debian Codegraph @

examples/no_routes.py

raw symbols SCIP
1 """
2 In this example nothing is swagged
3 this is useful for testing if Swagger is ignoring
4 no swagabble views.
5 """
6 from flask import Flask
7 from flask.views import MethodView
8
9 from flasgger import Swagger
10
11 app = Flask(__name__)
12 swag = Swagger()
13
14
15 @app.route('/')
16 def index():
17 return 'Hello World'
18
19
20 class TestView(MethodView):
21 def get(self):
22 return 'Hello World'
23
24
25 class Meow(MethodView):
26 """
27 This is to ensure Swagger does not break with empty MethodViews
28 issue #76
29 """
30 pass
31
32 app.add_url_rule(
33 '/meow/<int:param>/',
34 view_func=Meow.as_view('meow'),
35 methods=['DELETE']
36 )
37
38
39 app.add_url_rule(
40 '/testview',
41 view_func=TestView.as_view('testview'),
42 methods=['GET']
43 )
44
45
46 if __name__ == '__main__':
47 swag.init_app(app)
48 app.run(debug=True)