Spaces:
Runtime error
Runtime error
Update app.py
Browse files5 unmodified lines6789101112131415161718192021222324252627282930315 unmodified lines@app.route('/', defaults={'path': ''}, methods=['GET', 'POST'])@app.route('/<path:path>', methods=['GET', 'POST'])def proxy(path):# Prendi l'URL dal parametro ?url=url = request.args.get('url')if not url:return "Error: no URL provided", 400try:# Fai la richiesta al vero URLresp = requests.get(url, stream=True, timeout=30)# Ritorna la risposta al clientreturn Response(resp.content, mimetype=resp.headers.get('content-type'))except Exception as e:return f"Error: {str(e)}", 500if __name__ == '__main__':app.run(host='0.0.0.0', port=7860)```**PASSO 4: Crea il file `requirements.txt`**```Flask==2.3.0requests==2.31.05 unmodified lines67891011121314151617181920215 unmodified lines@app.route('/', defaults={'path': ''}, methods=['GET', 'POST'])@app.route('/<path:path>', methods=['GET', 'POST'])def proxy(path):url = request.args.get('url')if not url:return "Error: no URL provided", 400try:resp = requests.get(url, stream=True, timeout=30)return Response(resp.content, mimetype=resp.headers.get('content-type'))except Exception as e:return f"Error: {str(e)}", 500if __name__ == '__main__':app.run(host='0.0.0.0', port=7860)
app.py+1-11