Mercurial > public > tweet-analysis
changeset 4:cfd876570008
attach inline policy to function to access screts
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Thu, 16 Sep 2021 18:03:26 +0200 |
parents | 5c36f51105c2 |
children | 54e71cf6e324 |
files | src/handlers/sentiment.py template.yaml |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/handlers/sentiment.py Thu Sep 16 16:51:59 2021 +0200 +++ b/src/handlers/sentiment.py Thu Sep 16 18:03:26 2021 +0200 @@ -20,12 +20,12 @@ bearer_token = twitter_key['BEARER'] twitter_header = {"Authorization": "Bearer {}".format(bearer_token)} # Auth header twitter_response = requests.request("GET", twitter_url, headers=twitter_header) - print(twitter_response.json()) return { "statusCode": 200, "body": json.dumps({ "message": "hello world", + "tweets": twitter_response.json() }), }
--- a/template.yaml Thu Sep 16 16:51:59 2021 +0200 +++ b/template.yaml Thu Sep 16 18:03:26 2021 +0200 @@ -157,6 +157,10 @@ CodeUri: src/ Handler: handlers/sentiment.get_tweet_sentiment Runtime: python3.9 + Policies: + - AWSSecretsManagerGetSecretValuePolicy: + SecretArn: + arn:aws:secretsmanager:eu-west-2:339008578167:secret:tweet-analysis-keys-gKo6DQ Events: CallGetTweetSentiment: Type: Api