Web Server to Play a Sound when a URL is Visited

The following is a simple web server that plays a sound file when a URL is visited.
The following Python script will play the sound file "alarm.mp3" (located in the same directory as the server) when the following URL is visited:
http://your_server_ip:8080/alarm
This can be used as a notification or alarm when triggered by a process on some other machine. The server runs on port 8080. If you are running a firewall you may need to allow this port.
Requirements:
pip install flask
pip install playsound
#!/usr/bin/env python3 from flask import Flask from playsound import playsound app = Flask(__name__) @app.route('/alarm') def hello_world(): playsound("alarm.mp3") return 'Ringing alarm!' if __name__ == '__main__': app.run(host='0.0.0.0', port=8080)