Mercurial > public > tweet-analysis
comparison dependencies/python/event_controller.py @ 8:6541622b6127
add tweet analysis method
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Fri, 17 Sep 2021 21:10:02 +0200 |
parents | 54e71cf6e324 |
children |
comparison
equal
deleted
inserted
replaced
7:1b1296559c31 | 8:6541622b6127 |
---|---|
1 def unwrap_sentiment_string_parameters(event): | 1 class SentimentFunctionEvent: |
2 """ | |
3 Unwrap string parameters from /sentiment api call | |
4 :param event: dict, required | |
5 API Gateway Lambda Proxy Input Format | |
6 :return: | |
7 """ | |
8 | 2 |
9 twitter_user = 'Twitter' | 3 @staticmethod |
10 number_of_tweets = '100' | 4 def unwrap_parameters(event): |
5 """ | |
6 Unwrap string parameters from /sentiment api call | |
7 :param event: dict, required | |
8 API Gateway Lambda Proxy Input Format | |
9 :return: | |
10 """ | |
11 | 11 |
12 query_string_parameters = event['queryStringParameters'] | 12 twitter_user = 'Twitter' |
13 if event['queryStringParameters'] is not None: | 13 number_of_tweets = '100' |
14 if 'twitterUser' in query_string_parameters: | |
15 twitter_user = query_string_parameters['twitterUser'] | |
16 if not twitter_user: | |
17 twitter_user = 'Twitter' | |
18 | 14 |
19 if 'numberOfTweets' in query_string_parameters: | 15 query_string_parameters = event['queryStringParameters'] |
20 number_of_tweets = query_string_parameters['numberOfTweets'] | 16 if event['queryStringParameters'] is not None: |
21 if not number_of_tweets: | 17 if 'twitterUser' in query_string_parameters: |
22 number_of_tweets = '100' | 18 twitter_user = query_string_parameters['twitterUser'] |
19 if not twitter_user: | |
20 twitter_user = 'Twitter' | |
23 | 21 |
24 return twitter_user, number_of_tweets | 22 if 'numberOfTweets' in query_string_parameters: |
23 number_of_tweets = query_string_parameters['numberOfTweets'] | |
24 if not number_of_tweets: | |
25 number_of_tweets = '100' | |
26 | |
27 return twitter_user, number_of_tweets |