在下面的代码中,print语句不返回任何内容。
import boto3
import json
import os
# Initiate Firehose client
firehose_client = boto3.client('firehose')
def lambda_handler(event, context):
records = []
batch = []
try :
for record in event['Records']:
tweet = {}
print(record['dynamodb']['Keys']['sentiment']['S'])
t_stats = '{"sentiment":"%s", "totalnumber":"%n"}\n'\
% (record['dynamodb']['Keys']['sentiment']['S'],\
record['dynamodb']['totalnumber']['N'])
tweet["Data"] = t_stats
records.append(tweet)
batch.append(records)
res = firehose_client.put_record_batch(
DeliveryStreamName = os.environ['firehose_stream_name'],
Records = batch[0]
)
return 'Successfully processed {} records.'.format(len(event['Records']))
except Exception :
pass