Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sms_subscription():
- contact_num = request.values.get('From')
- response = request.values.get('Body')
- resp = MessagingResponse()
- #NEW SUBSCRIBERS
- if response.lower() == 'memphis':
- with open('Subscriber_List.csv', 'r+') as subscriber_list:
- subscriber_list_writer = csv.writer(subscriber_list)
- for contact in subscriber_list:
- if contact == contact_num:
- resp.message("Your already subscribed")
- return str(resp)
- else:
- subscriber_list_writer.writerow([contact_num])
- resp.message("Thanks for subscribing to our local coupon book. As we get new deals, we'll notify via SMS. To opt-out reply 'STOP'")
- return str(resp)
- else:
- resp.message("Be sure to check spelling and for spaces and try again.")
- return str(resp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement