77
88 app = Flask(__name__)
99
10- @app.route('/gists/<gist_id>')
10+
11+ @app.route("/gists/<gist_id>")
1112 def gist_detail(gist_id):
1213 '''Gist detail view.
1314 ---
@@ -18,11 +19,12 @@ def gist_detail(gist_id):
1819 schema:
1920 $ref: '#/definitions/Gist'
2021 '''
21- return 'detail for gist {}'.format(gist_id)
22+ return "detail for gist {}".format(gist_id)
23+
2224
2325 with app.test_request_context():
2426 spec.path(view=gist_detail)
25- print(spec.to_dict()[' paths' ])
27+ print(spec.to_dict()[" paths" ])
2628 # {'/gists/{gist_id}': {'get': {'responses': {200: {'schema': {'$ref': '#/definitions/Gist'}}}},
2729 # 'x-extension': 'metadata'}}
2830
@@ -33,33 +35,36 @@ def gist_detail(gist_id):
3335
3436 app = Flask(__name__)
3537
38+
3639 class GistApi(MethodView):
3740 '''Gist API.
3841 ---
3942 x-extension: metadata
4043 '''
44+
4145 def get(self):
42- '''Gist view
43- ---
44- responses:
45- 200:
46- schema:
47- $ref: '#/definitions/Gist'
48- '''
49- pass
46+ '''Gist view
47+ ---
48+ responses:
49+ 200:
50+ schema:
51+ $ref: '#/definitions/Gist'
52+ '''
53+ pass
5054
5155 def post(self):
52- pass
56+ pass
57+
5358
54- method_view = GistApi.as_view(' gists' )
59+ method_view = GistApi.as_view(" gists" )
5560 app.add_url_rule("/gists", view_func=method_view)
5661 with app.test_request_context():
5762 spec.path(view=method_view)
5863
5964 # Alternatively, pass in an app object as a kwarg
6065 # spec.path(view=method_view, app=app)
6166
62- print(spec.to_dict()[' paths' ])
67+ print(spec.to_dict()[" paths" ])
6368 # {'/gists': {'get': {'responses': {200: {'schema': {'$ref': '#/definitions/Gist'}}}},
6469 # 'post': {},
6570 # 'x-extension': 'metadata'}}
0 commit comments