Skip to content

Instantly share code, notes, and snippets.

@perryism
Created December 3, 2019 19:12
Show Gist options
  • Save perryism/7fa01316fced4db98e628413b255c9d0 to your computer and use it in GitHub Desktop.
Save perryism/7fa01316fced4db98e628413b255c9d0 to your computer and use it in GitHub Desktop.
the script dumps the headers and the body of a request
from flask import Flask, request
app = Flask(__name__)
import logging, sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
logger = logging.getLogger(__name__)
@app.route("/", methods=["POST", "GET"])
def call():
req = "%s%s"%(request.headers, request.stream.read())
logger.debug(req)
return req
if __name__ == "__main__":
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment