tonyassi's picture
Update app.py
7ca4751 verified
raw
history blame
783 Bytes
from flask import Flask, request, jsonify
import logging
app = Flask(__name__)
# Configure logging to display outputs in Hugging Face logs
#logging.basicConfig(level=logging.INFO)
@app.route('/')
def index():
content ="""
Hello, Webhook Receiver! <br><br>
curl -X POST "https://tonyassi-webhook-receiver-dev.hf.space/json" \
-H "Content-Type: application/json" \
-d '{"key1": "value1", "key2": "value2"}'
"""
return content
@app.route('/json', methods=['POST'])
def handle_json():
data = request.get_json()
print(data)
# Log the request for debugging
#logging.info(f"Received JSON: {data}")
return jsonify(data), 200 # Return JSON response with HTTP 200
if __name__ == '__main__':
app.run(host="0.0.0.0", port=7860)