basic_lambda_function.py 589 B

1234567891011121314151617181920212223242526272829
  1. '''
  2. Basic Twilio handler function
  3. '''
  4. import boto3
  5. import random
  6. import StringIO
  7. import urllib2
  8. from boto3.dynamodb.conditions import Key
  9. from boto3.session import Session
  10. # create an S3 & Dynamo session
  11. s3 = boto3.resource('s3')
  12. session = Session()
  13. def lambda_handler(event, context):
  14. message = event['body']
  15. from_number = event['fromNumber']
  16. pic_url = event['image']
  17. num_media = event['numMedia']
  18. if num_media != '0':
  19. twilio_resp = "Hi I got an image @ location %s" % pic_url
  20. else:
  21. twilio_resp = 'No image found'
  22. return twilio_resp