Flask-RESTful Documentation Release 0.3.10control of over API format support; so a year down the road you don’t have to support people using the CSV representation of your API you didn’t even know existed. To add additional mediatypes to your API, representations (xml, csv, html), you can use the representation() decorator. You need to have a reference to your API. api = Api(app) @api.representation('text/csv') def output_csv(data, code, headers=None): headers=None): pass # implement csv output! These output functions take three parameters, data, code, and headers data is the object you return from your resource method, code is the HTTP status code0 码力 | 42 页 | 84.60 KB | 1 年前3
Flask-RESTful Documentation
Release 0.3.10control of over API format support; so a year down the road you don’t have to support people using the CSV representation of your API you didn’t even know existed. To add additional mediatypes to your API, representations (xml, csv, html), you can use the representation() decorator. You need to have a reference to your API. api = Api(app) @api.representation('text/csv') def output_csv(data, code, headers=None): headers=None): pass # implement csv output! These output functions take three parameters, data, code, and headers data is the object you return from your resource method, code is the HTTP status code that0 码力 | 39 页 | 212.29 KB | 1 年前3
Flask-RESTful Documentation
Release 0.3.6control of over API format support; so a year down the road you don’t have to support people using the CSV representation of your API you didn’t even know existed. To add additional mediatypes to your API, representations (xml, csv, html), you can use the representation() decorator. You need to have a reference to your API. api = Api(app) @api.representation('text/csv') def output_csv(data, code, headers=None): headers=None): pass # implement csv output! 1.5. Extending Flask-RESTful 19 Flask-RESTful Documentation, Release 0.3.6 These output functions take three parameters, data, code, and headers data is the object0 码力 | 46 页 | 245.60 KB | 1 年前3
Flask-RESTful Documentation Release 0.3.6control of over API format support; so a year down the road you don’t have to support people using the CSV representation of your API you didn’t even know existed. To add additional mediatypes to your API, representations (xml, csv, html), you can use the representation() decorator. You need to have a reference to your API. api = Api(app) @api.representation('text/csv') def output_csv(data, code, headers=None): headers=None): pass # implement csv output! These output functions take three parameters, data, code, and headers data is the object you return from your resource method, code is the HTTP status code0 码力 | 49 页 | 91.90 KB | 1 年前3
Flask-RESTful Documentation
Release 0.3.7control of over API format support; so a year down the road you don’t have to support people using the CSV representation of your API you didn’t even know existed. To add additional mediatypes to your API, representations (xml, csv, html), you can use the representation() decorator. You need to have a reference to your API. api = Api(app) @api.representation('text/csv') def output_csv(data, code, headers=None): headers=None): pass # implement csv output! These output functions take three parameters, data, code, and headers data is the object you return from your resource method, code is the HTTP status code that0 码力 | 50 页 | 253.09 KB | 1 年前3
Flask-RESTful Documentation
Release 0.3.8control of over API format support; so a year down the road you don’t have to support people using the CSV representation of your API you didn’t even know existed. To add additional mediatypes to your API, representations (xml, csv, html), you can use the representation() decorator. You need to have a reference to your API. api = Api(app) @api.representation('text/csv') def output_csv(data, code, headers=None): headers=None): pass # implement csv output! These output functions take three parameters, data, code, and headers data is the object you return from your resource method, code is the HTTP status code that0 码力 | 50 页 | 253.64 KB | 1 年前3
Flask-RESTful Documentation Release 0.3.8control of over API format support; so a year down the road you don’t have to support people using the CSV representation of your API you didn’t even know existed. To add additional mediatypes to your API, representations (xml, csv, html), you can use the representation() decorator. You need to have a reference to your API. api = Api(app) @api.representation('text/csv') def output_csv(data, code, headers=None): headers=None): pass # implement csv output! These output functions take three parameters, data, code, and headers data is the object you return from your resource method, code is the HTTP status code0 码力 | 55 页 | 93.30 KB | 1 年前3
Flask-RESTful Documentation Release 0.3.7control of over API format support; so a year down the road you don’t have to support people using the CSV representation of your API you didn’t even know existed. To add additional mediatypes to your API, representations (xml, csv, html), you can use the representation() decorator. You need to have a reference to your API. api = Api(app) @api.representation('text/csv') def output_csv(data, code, headers=None): headers=None): pass # implement csv output! These output functions take three parameters, data, code, and headers data is the object you return from your resource method, code is the HTTP status code0 码力 | 55 页 | 93.21 KB | 1 年前3
Flask Documentation (1.1.x)generators and direct responses. Basic Usage This is a basic view function that generates a lot of CSV data on the fly. The trick is to have an inner function that uses a generator to generate data and route('/large.csv') def generate_large_csv(): def generate(): for row in iter_all_rows(): yield ','.join(row) + '\n' return Response(generate(), mimetype='text/csv') Each yield0 码力 | 428 页 | 895.98 KB | 1 年前3
Flask Documentation (1.1.x)generators and direct responses. Basic Usage This is a basic view function that generates a lot of CSV data on the fly. The trick is to have an inner function that uses a generator to generate data and Response @app.route('/large.csv') def generate_large_csv(): def generate(): for row in iter_all_rows(): yield ','.join(row) + '\n' return Response(generate(), mimetype='text/csv') Each yield expression0 码力 | 291 页 | 1.25 MB | 1 年前3
共 10 条
- 1













