Print raw HTTP request in Flask or WSGI

前端 未结 7 1236
名媛妹妹
名媛妹妹 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:24

    if you're using a logger i found this useful

    https://docs.python.org/3/library/pprint.html#pprint.pformat

    from pprint import pformat
    import requests
    log.debug(pformat(request.headers))
    

提交回复
热议问题