File size: 606 Bytes
0c89d71
 
9599633
 
 
 
 
50846c7
7ca4751
50846c7
 
 
 
 
 
 
9599633
 
 
0c89d71
c314cdb
5e26b89
0c89d71
 
9599633
 
0c89d71
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)