Skip to content

Instantly share code, notes, and snippets.

@lornajane
Created July 13, 2020 13:22
Show Gist options
  • Select an option

  • Save lornajane/e2f0ffd11dd8abb40215cabc691aff55 to your computer and use it in GitHub Desktop.

Select an option

Save lornajane/e2f0ffd11dd8abb40215cabc691aff55 to your computer and use it in GitHub Desktop.

Revisions

  1. lornajane created this gist Jul 13, 2020.
    25 changes: 25 additions & 0 deletions app.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    import logging
    import pprint
    from flask import Flask
    from flask import jsonify
    from flask import request
    from pprint import pformat


    app = Flask(__name__)
    logging.basicConfig(level=logging.DEBUG)

    @app.route('/json')
    def serve_json():
    response = {
    "message": "Hello",
    "number": 42
    }
    return jsonify(response)

    @app.route('/webhook', methods=['GET','POST'])
    def webhook():
    logging.info("Request received")
    logging.info(request.args)
    logging.info(request.form)
    return "OK"