Skip to content

Instantly share code, notes, and snippets.

@nealrs
Last active July 29, 2016 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nealrs/95698e1b0be45e919017980897a39ca6 to your computer and use it in GitHub Desktop.
Save nealrs/95698e1b0be45e919017980897a39ca6 to your computer and use it in GitHub Desktop.
Get caller Name from Twilio
def callerName(tel):
r = requests.get("https://lookups.twilio.com/v1/PhoneNumbers/"+tel, params={'Type': 'caller-name'}, auth=(sid, tok) )
try:
# return a list of first, last, etc. names instead of 1 string
name = r.json()['caller_name']['caller_name'].split()
except Exception, e:
print "error getting caller name: "+ repr(e)
name=None
return name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment