Spaces:
Build error
Build error
Download app.py from RockCoder23/GetProxyv2: direct link, hf CLI and curl.
- Browser
- Download file 605 Bytes
-
https://huggingface.co/spaces/RockCoder23/GetProxyv2/resolve/bb514b593614ef4a5a36e5e01d3d9af34ecaf080/app.py
- Command line
-
hf download hf://spaces/RockCoder23/GetProxyv2@bb514b593614ef4a5a36e5e01d3d9af34ecaf080/app.py
-
curl -L -o app.py https://huggingface.co/spaces/RockCoder23/GetProxyv2/resolve/bb514b593614ef4a5a36e5e01d3d9af34ecaf080/app.py
605 Bytes
| import requests | |
| from flask import Flask, request, jsonify | |
| app = Flask(__name__) | |
| 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) | |