khankashif commited on
Commit
5d14a84
·
verified ·
1 Parent(s): 2b61118

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request
2
+ from notification import send_notification
3
+ from config import prayer_times
4
+
5
+ app = Flask(__name__)
6
+
7
+ @app.route('/incoming_call', methods=['POST'])
8
+ def incoming_call():
9
+ caller_id = request.json.get('caller_id')
10
+ current_time = request.json.get('current_time')
11
+
12
+ if current_time in prayer_times:
13
+ message = "I am currently in prayer. Please call later."
14
+ send_notification(caller_id, message)
15
+
16
+ return {"status": "notification sent"}, 200
17
+
18
+ if __name__ == '__main__':
19
+ app.run(debug=True)