sehaj13 commited on
Commit
4df5dbd
·
verified ·
1 Parent(s): c04c4b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -113,14 +113,17 @@ with app_tab:
113
  # --- Send data to external API ---
114
  url = "https://sehajpreet-aiml-2025.glitch.me/addg"
115
  data = {'rno': '15', 'sname': pname, 'sclass': '7'}
116
- req = request.Request(url , method="POST", data=data)
117
-
118
- # Response
119
- resp = request.urlopen(req)
120
- if response.status_code == 200:
121
- st.success("Data updated on: " + "https://aimljan25f.glitch.me/")
 
 
 
122
  else:
123
- st.warning("Data not updated")
124
  # try:
125
 
126
  # response = requests.post(url, data=data)
 
113
  # --- Send data to external API ---
114
  url = "https://sehajpreet-aiml-2025.glitch.me/addg"
115
  data = {'rno': '15', 'sname': pname, 'sclass': '7'}
116
+
117
+ try:
118
+ response = requests.post(url, data=data)
119
+ if response.status_code == 200:
120
+ st.success("Attendance marked successfully.")
121
+ else:
122
+ st.warning("Failed to update attendance.")
123
+ except Exception as e:
124
+ st.error(f"Request failed: {e}")
125
  else:
126
+ st.error(" Match not found. Try again.")
127
  # try:
128
 
129
  # response = requests.post(url, data=data)