From 4428b6dca602cc7074e6a0cea0f8d9b24e1c9711 Mon Sep 17 00:00:00 2001 From: DEENUU1 Date: Mon, 1 Jan 2024 20:21:26 +0100 Subject: [PATCH] Create main_handler --- main.py | 16 ++++++++++++++++ tasks.py | 3 --- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..7920ba8 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +from tasks import run_jjit +import json + + +def main_handler(event, context): + site_id = event.get("site_id") + + if site_id == "jjit": + run_jjit() + else: + return + + return { + "statusCode": 200, + "body": json.dumps(f"Scraping for site {site_id} completed") + } diff --git a/tasks.py b/tasks.py index 7bf9210..e2cdebc 100644 --- a/tasks.py +++ b/tasks.py @@ -22,6 +22,3 @@ def run_jjit(): print("Data saved successfully") else: print("Could not send scraped data via API") - - -run_jjit()