Log Connexion request body

Kevin Martins
1 min readMar 3, 2020

--

Connexion is a framework on top of Flask that automagically handles HTTP requests defined using OpenAPI

Zalando logo

Connexion it’s an amazing framework but logging in the request body may not be such an easy task.

To log Connexion request body just add the following code:

import connexion
from flask import request

app = connexion.App(__name__, specification_dir="./swagger/")


@app.app.before_request
def log_request_info():
print('Body: %s', request.get_data())
logger.info('Body: %s', request.get_data())

Hope this helps !

--

--