Flask APK Server
Overview
This Flask application serves an APK file to clients. Developed as a minimalistic solution, the app is designed to be used in a controlled environment with a limited number of users.
Features:
- Simple endpoint (
/apk
) to download the APK. - Endpoint (
/test
) to test the server's functionality. - Endpoint (
/apk-test
) to check the presence and size of the APK file.
Flask App:
pythonfrom flask import Flask, send_fileimport osapp = Flask(__name__)@app.route('/apk')def download_apk(): apk_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'app.apk') return send_file(apk_path, as_attachment=True, download_name='app.apk')@app.route('/apk-test')def test_apk(): apk_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'app.apk') try: size = os.path.getsize(apk_path) return jsonify(status="success", message=f"The APK exists and its size is {size} bytes") except OSError: return jsonify(status="error", message="The APK does not exist or there's a problem accessing it.")@app.route('/test')def test_route(): return "Test route is working!"if __name__ == '__main__': app.run(host='0.0.0.0', port=2000, debug=True)
Top comments(0)
Subscribe
For further actions, you may consider blocking this person and/orreporting abuse