From 890bd313bd072aa3490cfd2fc965836f86bd99f9 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 25 Mar 2026 13:53:42 +0000 Subject: [PATCH] minor tweaks --- backend/pashub_fetcher/handler/handler.py | 17 +++++++++-------- backend/pashub_fetcher/token_getter.py | 4 +++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/backend/pashub_fetcher/handler/handler.py b/backend/pashub_fetcher/handler/handler.py index af5ed336..fb7d6b1d 100644 --- a/backend/pashub_fetcher/handler/handler.py +++ b/backend/pashub_fetcher/handler/handler.py @@ -1,6 +1,7 @@ import os import re -import time + +# import time from typing import Any, Dict, List, Mapping from openpyxl import load_workbook @@ -49,12 +50,6 @@ def extract_jobs(filepath: str) -> List[Job]: job_id = match.group(1) jobs.append({"id": job_id, "address": str(name)}) - if not match: - continue - - job_id = match.group(1) - - jobs.append({"id": job_id, "address": str(name)}) return jobs @@ -113,6 +108,12 @@ def handler(event: Mapping[str, Any], context: Any) -> None: pashub_client.get_core_evidence_files_by_job_id(job["id"]) ) - time.sleep(10) # Simulate manual download + # time.sleep(10) # Simulate manual download print(f"saved {len(saved_file_paths)} files") + + +if __name__ == "__main__": + event = {"Records": [{"body": "{}"}]} + + handler(event, None) diff --git a/backend/pashub_fetcher/token_getter.py b/backend/pashub_fetcher/token_getter.py index d5481dd5..5954feec 100644 --- a/backend/pashub_fetcher/token_getter.py +++ b/backend/pashub_fetcher/token_getter.py @@ -24,7 +24,9 @@ def get_token_from_local_storage(email: str, password: str) -> str: page.fill("#password", password) logger.info("Submitting login...") - page.click("#btn-login") + page.wait_for_selector("#btn-login", state="visible", timeout=10000) + with page.expect_navigation(timeout=15000): + page.click("#btn-login") page.wait_for_timeout(3000)