GetProxyv2 / app.py
RockCoder23's picture
Rename get.py to app.py
9c6114a verified
Raw History Blame
605 Bytes
import requests
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/fetch', methods=['POST'])
def fetch_url_content():
data = request.json
target_url = data.get('url')
if not target_url:
return jsonify({"error": "No URL provided"}), 400
try:
response = requests.get(target_url)
return jsonify({
"status_code": response.status_code,
"content": response.text
})
except Exception as e:
return jsonify({"error": str(e)}), 500
if __name__ == '__main__':
app.run(host='0.0.0.0', port=7860)