· 7 years ago · Jun 20, 2018, 04:54 PM
1import json
2import boto3
3
4access_key=""
5secret_key=""
6
7def tweets_processor(event, context):
8
9 tweet = event['data']
10 print tweet
11
12 # we found a tweet that is of interest push the record to SNS for mobile notification
13 client = boto3.client('sns',
14 region_name='eu-west-1',
15 aws_access_key_id=access_key,
16 aws_secret_access_key=secret_key)
17 response = client.publish(TargetArn="arn:aws:sns:eu-west-1:587264368683:kubeless-tweets", Message=json.dumps({'default': json.dumps(tweet)}),MessageStructure='json')
18 return