flexmeasures.api.common.utils.decorators
Functions
- flexmeasures.api.common.utils.decorators.as_response_type(response_type)
Decorator which adds a “type” parameter to the data of the flask response. Example:
@app.route(‘/postMeterData’) @as_response_type(“PostMeterDataResponse”) @as_json def post_meter_data() -> dict:
return {“message”: “Meter data posted”}
The response.json will be:
- {
“message”: “Meter data posted”, “type”: “PostMeterDataResponse”
}
- Parameters:
response_type – The response type.