Add lambda related fikes

This commit is contained in:
2020-04-29 23:14:13 -04:00
parent 9d0d6ccf8a
commit c85d5cada4
4 changed files with 20 additions and 10 deletions

9
.idea/terminal.xml generated Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="TerminalProjectOptionsProvider">
<envs>
<env key="AWS_TOKEN_ID" value="AKIAIIITA3BAG6LBBZ7A" />
<env key="AWS_TOKEN" value="OkJJ/LubZea6KbicszllpUKf6QvawCzOGxMJAaR5" />
</envs>
</component>
</project>

View File

@@ -1,16 +1,18 @@
from app import fact_service, groupme from app import fact_service, groupme
from util import constants from util import constants
if __name__ == '__main__':
def post_fact_to_group():
# Get Groupme api token to post with # Get Groupme api token to post with
groupme_client = groupme.get_client() groupme_client = groupme.get_client()
# Get specific group from groupme # Get specific group from groupme
fact_bot = groupme.get_bot(constants.BOT_NAME) fact_bot = groupme.get_bot(constants.BOT_NAME)
# Get Random Fact # Get Random Fact
fact = fact_service.get_random_fact() fact = fact_service.get_random_fact()
# Post fact in Group # Post fact in Group
# groupme_client. # groupme_client.
message = fact_bot.post(text=fact) message = fact_bot.post(text=fact)
if __name__ == '__main__':
post_fact_to_group()

View File

@@ -1,10 +1,10 @@
region: us-east-1 region: us-east-2
function_name: avan_facts_bot function_name: avan_facts_bot
handler: service.handler handler: service.handler
description: Random Avan facts vis groupme description: Random Avan facts via groupme
runtime: python3.8 runtime: python3.8
# role: lambda_basic_execution #role: lambda_basic_execution
# S3 upload requires appropriate role with s3:PutObject permission # S3 upload requires appropriate role with s3:PutObject permission
# (ex. basic_s3_upload), a destination bucket, and the key prefix # (ex. basic_s3_upload), a destination bucket, and the key prefix

View File

@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from app import fact_bot
def handler(event, context): def handler(event, context):
# Your code goes here! # Your code goes here!
e = event.get("e") fact_bot.post_fact_to_group()
pi = event.get("pi")
return e + pi