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
共 1 条
- 1













