Skip to content

Commit

Permalink
parsing Twilio data to get From number
Browse files Browse the repository at this point in the history
  • Loading branch information
sara committed Jul 3, 2018
1 parent 32f7c60 commit 90a4d9b
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions garfield/lookup/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,14 @@
def index(request):
print(request)
response = MessagingResponse()
response.message(lookup_contact("+17327591778"))
response.message(lookup_contact(request))
return response
#return lookup_contact('+17327591778')
#response = MessagingResponse()
#response.message("Hello World!")
#return response

def lookup_contact(contact_number:str):
suspect_information = {}
contact = Contact.objects.get(phone_number = contact_number)
print(contact)

def lookup_contact(request):
suspect_number = request.GET.get('From')
contact = Contact.objects.get(phone_number = suspect_number)
if contact != None:
return (contact[0].nextcaller_first_name)
return (contact.nextcaller_first_name)
else:
return ("No contact")

Expand Down

0 comments on commit 90a4d9b

Please sign in to comment.