From 8e1aacf846aca339356290c636f118d9ce79d69f Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 24 Mar 2026 14:57:08 +0000 Subject: [PATCH] rename cotality client to pashub client --- backend/pashub_fetcher/handler/handler.py | 12 +++++++----- .../{cotality_client.py => pashub_client.py} | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) rename backend/pashub_fetcher/{cotality_client.py => pashub_client.py} (99%) diff --git a/backend/pashub_fetcher/handler/handler.py b/backend/pashub_fetcher/handler/handler.py index df187f3e..a4ee5339 100644 --- a/backend/pashub_fetcher/handler/handler.py +++ b/backend/pashub_fetcher/handler/handler.py @@ -1,7 +1,7 @@ import time from typing import Any, List, Mapping -from backend.pashub_fetcher.cotality_client import CotalityClient, UnauthorizedError +from backend.pashub_fetcher.pashub_client import PashubClient, UnauthorizedError from backend.pashub_fetcher.token_getter import get_token_from_local_storage from utils.logger import setup_logger @@ -20,7 +20,7 @@ def handler(event: Mapping[str, Any], context: Any) -> None: logger.error("Error getting auth token from Pas Hub") raise - client = CotalityClient(token=token) + pashub_client = PashubClient(token=token) jobs = [ "5abf6e27-e4c4-4ba8-b69d-9e34939e0002", @@ -30,17 +30,19 @@ def handler(event: Mapping[str, Any], context: Any) -> None: saved_files: List[str] = [] for job_id in jobs: try: - saved_files.extend(client.get_core_envidence_files_by_job_id(job_id)) + saved_files.extend(pashub_client.get_core_envidence_files_by_job_id(job_id)) + + # Upload files to sharepoint except UnauthorizedError: logger.warning("Token expired — refreshing") token = get_token_from_local_storage(pas_hub_email, pas_hub_password) - client = CotalityClient(token=token) + pashub_client = PashubClient(token=token) # retry once - saved_files.extend(client.get_core_envidence_files_by_job_id(job_id)) + saved_files.extend(pashub_client.get_core_envidence_files_by_job_id(job_id)) time.sleep(10) # Simulate manual download diff --git a/backend/pashub_fetcher/cotality_client.py b/backend/pashub_fetcher/pashub_client.py similarity index 99% rename from backend/pashub_fetcher/cotality_client.py rename to backend/pashub_fetcher/pashub_client.py index b4a30dc2..bed7395f 100644 --- a/backend/pashub_fetcher/cotality_client.py +++ b/backend/pashub_fetcher/pashub_client.py @@ -17,7 +17,7 @@ class UnauthorizedError(Exception): pass -class CotalityClient: +class PashubClient: def __init__(self, token: str): self.token = token