Listify/Lambdas/Scraping/runOrchestrator.py
NMerz 79598bf9e9 Lambdaify Kohls scraping
Move to Lambda function setup and add orchestration and word lists for full runs. Credit for the word lists goes to: http://www.desiquintans.com/nounlist
2020-10-18 17:51:08 -04:00

19 lines
559 B
Python

import json
import boto3
def lambda_handler(event, context):
with open("words.txt") as words_file:
words = json.load(words_file)
print(words)
for word in words:
client = boto3.client('lambda')
response = client.invoke(
FunctionName='KohlsScraper',
InvocationType="Event",
LogType="None",
Payload= """{"toScrape": \"""" + word + "\"}"
)
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}