tonyassi's picture
Update app.py
c314cdb verified
raw
history blame contribute delete
606 Bytes
from flask import Flask, request, jsonify
import logging
app = Flask(__name__)
@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)
return jsonify(data), 200 # Return JSON response with HTTP 200
if __name__ == '__main__':
app.run(host="0.0.0.0", port=7860)