Google News
logo
Flask - Interview Questions
How to log request body in python flask?
You can take advantage of Flask.before_request hook to log the request body in python flask. Here is an example :
 
@app.before_request
def log_request_info():
    app.logger.debug('Headers: %s', request.headers)
    app.logger.debug('Body: %s', request.get_data())

 

Advertisement