KeshavRa commited on
Commit
2d36ab1
·
verified ·
1 Parent(s): 9c22ed4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -12
app.py CHANGED
@@ -295,6 +295,26 @@ else:
295
  # convert pandas df into list of dicts
296
  shelters = shelters.to_dict(orient='records')
297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  st.session_state.shelters_filtered = True
299
  st.session_state.shelters = shelters
300
 
@@ -352,18 +372,6 @@ else:
352
  folium_static(map)
353
  st.markdown(f" ## [Get Directions](https://www.google.com/maps/dir/?api=1&origin=current+location&destination={lat},{long})")
354
  st.divider()
355
-
356
- # text messaging
357
- if len(data['Phone Number']) == 12 and data['Consent']:
358
- account_sid = os.environ["SID"]
359
- auth_token = os.environ["auth_token"]
360
- client = Client(account_sid, auth_token)
361
-
362
- message = client.messages.create(
363
- body = 'test',
364
- from_= "+15107212356",
365
- to = data['Phone Number']
366
- )
367
 
368
  # Create two columns
369
  col1, col2, col3 = st.columns([1,1,1])
 
295
  # convert pandas df into list of dicts
296
  shelters = shelters.to_dict(orient='records')
297
 
298
+ # text messaging
299
+ if len(data['Phone Number']) == 12 and data['Consent']:
300
+ account_sid = os.environ["SID"]
301
+ auth_token = os.environ["auth_token"]
302
+ client = Client(account_sid, auth_token)
303
+
304
+ for i in len(shelters):
305
+ message_body.append(f'''
306
+ {shelters[i]['Organization Name']}: {shelters[i]['Program Name']}
307
+ 🕒 Open Hours: {shelters[i]['Open Hours']}
308
+ 📍 Address**: {shelters[i]['Address']}
309
+ 📞 Phone Number: ({phone_number[1:4]}) {phone_number[4:7]}-{phone_number[7:]}\n
310
+ ''')
311
+
312
+ message = client.messages.create(
313
+ body = message_body,
314
+ from_= "+15107212356",
315
+ to = data['Phone Number']
316
+ )
317
+
318
  st.session_state.shelters_filtered = True
319
  st.session_state.shelters = shelters
320
 
 
372
  folium_static(map)
373
  st.markdown(f" ## [Get Directions](https://www.google.com/maps/dir/?api=1&origin=current+location&destination={lat},{long})")
374
  st.divider()
 
 
 
 
 
 
 
 
 
 
 
 
375
 
376
  # Create two columns
377
  col1, col2, col3 = st.columns([1,1,1])