#!/usr/bin/env python3
from Flask import Flask, request, jsonify
from Flask_Cors import CORS
import requests
app = Flask(__name__)
CORS(app) # Enables CORS for all routes
@app.route('/proxy', methods=['GET'])
def proxy():
url = request.args.get('url')
if not url:
return jsonify({'error': 'URL parameter is required'}), 400
try:
response = requests.get(url)
return (response.content, response.status_code, response.headers.items())
except Exception as e:
return jsonify({'error': str(e)}), 500
# This part will run the Flask app under WSGI
if __name__ == '__main__':
app.run(debug=True)