Skip to content

Commit

Permalink
Refactor security PIN variable name in alternative_helper.py and sms-…
Browse files Browse the repository at this point in the history
…helper/__init__.py
  • Loading branch information
lperezmo committed Jan 17, 2024
1 parent 2002589 commit 0c0c656
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions alternative_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
#------------------------------------#
# Security check
#------------------------------------#
def process_incoming_message(security_pin, incoming_message, send_to, send_from):
def process_incoming_message(PIN, incoming_message, send_to, send_from):
"""
Generate a reply based on the incoming message.
Parameters
----------
security_pin : str
Security security_pin
PIN : str
Security PIN
incoming_message : str
Incoming message from Twilio
Expand All @@ -38,7 +38,7 @@ def process_incoming_message(security_pin, incoming_message, send_to, send_from)
message : str
Reply message
"""
if incoming_message.strip() == security_pin:
if incoming_message.strip() == PIN:
return """Welcome to Hess Services AI Assistant.
- I can schedule calls and text reminders for you.
- I can also just answer questions, within reason.
Expand All @@ -47,13 +47,13 @@ def process_incoming_message(security_pin, incoming_message, send_to, send_from)
messages = CLIENT.messages.list(from_=send_to, to=send_from)
sent_pin = False
for message in messages:
if message.body.strip() == security_pin:
if message.body.strip() == PIN:
sent_pin = True
if sent_pin:
follow_up_reply = get_follow_up_text(incoming_message)
return follow_up_reply
else:
return f"Please provide security PIN to continue. Hint: {security_pin}"
return f"Please provide security PIN to continue. Hint: {PIN}"

#------------------------------------#
# Current time
Expand Down
12 changes: 6 additions & 6 deletions sms-helper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def main(req: func.HttpRequest) -> func.HttpResponse:
# To reduce the number of messages you could use the 'alternative_helper'
# This one returns the response message as the HttpResponse.
#--------------------------------------------------------------------------#

response_for_user = alternative_helper.process_incoming_message(alternative_helper.SEC_PIN,
send_to,
send_from,
incoming_message)
return func.HttpResponse(response_for_user, status_code=200)
pin = alternative_helper.SEC_PIN
res = alternative_helper.process_incoming_message(PIN=pin,
incoming_message=incoming_message,
send_to=send_to,
send_from=send_from)
return func.HttpResponse(res, status_code=200)

0 comments on commit 0c0c656

Please sign in to comment.