Print raw HTTP request in Flask or WSGI

前端 未结 7 1294
名媛妹妹
名媛妹妹 2021-02-01 13:05

I am debugging a microcontroller I\'ve built which is writing raw HTTP requests line by line. I am using Flask for my backend and I would like to see the entire request as it a

7条回答
  •  花落未央
    2021-02-01 13:29

    With flask you have access to the request object which contains all the HTTP details:

    from flask import request
    
    @app.route('/')
    def index():
        print(request.headers)
    

提交回复
热议问题