Falcon v1.1.0 Documentationit: import falcon class Resource(object): def on_get(self, req, resp): resp.body = '{"message": "Hello world!"}' resp.status = falcon.HTTP_200 As you can see, Resource is just a regular class. You can msgpack class Resource(object): def on_get(self, req, resp): resp.data = msgpack.packb({'message': 'Hello world!'}) resp.content_type = 'application/msgpack' resp.status = falcon.HTTP_200 26 Chapter 6. Documentation import falcon class Resource(object): def on_get(self, req, resp): resp.body = '{"message": "Hello world!"}' resp.status = falcon.HTTP_200 Request class falcon.Request(env, options=None) Represents0 码力 | 113 页 | 426.53 KB | 1 年前3
 Falcon v3.0.0-b2 Documentationdef on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource()) app = CustomHeadersMiddleware( (continues filename="file1.txt" This is file1. --BbC04y Content-Disposition: attachment; filename="file2.txt" Hello, World! --BbC04y-- --AaB03x-- Note that all line endings in the form above are assumed to be CRLF falcon will take care of the rest. class MyResource: def on_get(self, req, resp): resp.media = { 'hello': 'World' } resp.text and resp.data are very similar, they both allow you to set the body of the0 码力 | 340 页 | 1.15 MB | 1 年前3
 Falcon v3.0.0 Documentationdef on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource()) app = CustomHeadersMiddleware( (continues filename="file1.txt" This is file1. --BbC04y Content-Disposition: attachment; filename="file2.txt" Hello, World! --BbC04y-- --AaB03x-- Note that all line endings in the form above are assumed to be CRLF falcon will take care of the rest. class MyResource: def on_get(self, req, resp): resp.media = { 'hello': 'World' } resp.text and resp.data are very similar, they both allow you to set the body of the0 码力 | 344 页 | 1.16 MB | 1 年前3
 Falcon v3.0.1 Documentationdef on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource()) app = CustomHeadersMiddleware( (continues filename="file1.txt" This is file1. --BbC04y Content-Disposition: attachment; filename="file2.txt" Hello, World! --BbC04y-- --AaB03x-- Note that all line endings in the form above are assumed to be CRLF falcon will take care of the rest. class MyResource: def on_get(self, req, resp): resp.media = { 'hello': 'World' } resp.text and resp.data are very similar, they both allow you to set the body of the0 码力 | 344 页 | 1.16 MB | 1 年前3
 Falcon v3.0.0-b1 Documentationdef on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource()) app = CustomHeadersMiddleware( app filename="file1.txt" This is file1. --BbC04y Content-Disposition: attachment; filename="file2.txt" Hello, World! --BbC04y-- --AaB03x-- Note that all line endings in the form above are assumed to be CRLF falcon will take care of the rest. class MyResource: def on_get(self, req, resp): resp.media = { 'hello': 'World' } resp.text and resp.data are very similar, they both allow you to set the body of the0 码力 | 338 页 | 1.14 MB | 1 年前3
 Falcon v3.1.1-b3 Documentationdef on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource()) app = CustomHeadersMiddleware( app filename="file1.txt" This is file1. --BbC04y Content-Disposition: attachment; filename="file2.txt" Hello, World! --BbC04y-- --AaB03x-- Note that all line endings in the form above are assumed to be CRLF Falcon will take care of the rest. class MyResource: def on_get(self, req, resp): resp.media = {'hello': 'World'} resp.text and resp.data are very similar, they both allow you to set the body of the response0 码力 | 378 页 | 1.29 MB | 1 年前3
 Falcon v3.1.1-b1 Documentationdef on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource()) app = CustomHeadersMiddleware( app filename="file1.txt" This is file1. --BbC04y Content-Disposition: attachment; filename="file2.txt" Hello, World! --BbC04y-- --AaB03x-- Note that all line endings in the form above are assumed to be CRLF Falcon will take care of the rest. class MyResource: def on_get(self, req, resp): resp.media = {'hello': 'World'} resp.text and resp.data are very similar, they both allow you to set the body of the response0 码力 | 378 页 | 1.29 MB | 1 年前3
 Falcon v3.1.1-a Documentationdef on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource()) app = CustomHeadersMiddleware( app filename="file1.txt" This is file1. --BbC04y Content-Disposition: attachment; filename="file2.txt" Hello, World! --BbC04y-- --AaB03x-- Note that all line endings in the form above are assumed to be CRLF Falcon will take care of the rest. class MyResource: def on_get(self, req, resp): resp.media = {'hello': 'World'} resp.text and resp.data are very similar, they both allow you to set the body of the response0 码力 | 378 页 | 1.29 MB | 1 年前3
 Falcon v3.1.0 Documentationdef on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource()) app = CustomHeadersMiddleware( app filename="file1.txt" This is file1. --BbC04y Content-Disposition: attachment; filename="file2.txt" Hello, World! --BbC04y-- --AaB03x-- Note that all line endings in the form above are assumed to be CRLF Falcon will take care of the rest. class MyResource: def on_get(self, req, resp): resp.media = {'hello': 'World'} resp.text and resp.data are very similar, they both allow you to set the body of the response0 码力 | 362 页 | 1.29 MB | 1 年前3
 Falcon v3.1.1 Documentationdef on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource()) app = CustomHeadersMiddleware( app filename="file1.txt" This is file1. --BbC04y Content-Disposition: attachment; filename="file2.txt" Hello, World! --BbC04y-- --AaB03x-- Note that all line endings in the form above are assumed to be CRLF Falcon will take care of the rest. class MyResource: def on_get(self, req, resp): resp.media = {'hello': 'World'} resp.text and resp.data are very similar, they both allow you to set the body of the response0 码力 | 378 页 | 1.29 MB | 1 年前3
共 40 条
- 1
 - 2
 - 3
 - 4
 













