You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from flask import Flask, request
import json
import os
from datetime import datetime
app = Flask(__name__)
# Define the path to store the dumped data
LOG_FILE = 'webhook_debug.log'
def dump_to_file(data):
with open(LOG_FILE, 'a') as f:
f.write(f"{data}\n\n")
@app.route('/webhook', methods=['POST'])
def webhook():
# Get the headers
headers = dict(request.headers)
# Get the JSON payload (or raw data if needed)
try:
payload = request.get_json()
except Exception as e:
payload = request.data.decode('utf-8')
# Prepare the dump content
dump_content = {
"timestamp": str(datetime.now()),
"headers": headers,
"payload": payload
}
# Write to file for debugging purposes
dump_to_file(json.dumps(dump_content, indent=4))
# Respond to the webhook request
return 'Webhook received and logged', 200
if __name__ == '__main__':
# Run the Flask server
app.run(host='0.0.0.0', port=5000)
Specifications
OpenCVE version: v2 branch
Python version: (what is in the docker image
Platform: Ubuntu
Screenshots (optional)
The text was updated successfully, but these errors were encountered:
Expected Behavior
added
{"Content-Type": "application/json", "X-Token": "xxxxx"}
in gui
Actual Behavior
header X-Token is missing
Steps to Reproduce the Problem
Specifications
Screenshots (optional)
The text was updated successfully, but these errors were encountered: