diff --git a/backend/pashub_fetcher/pashub_service.py b/backend/pashub_fetcher/pashub_service.py index 0a5fb535..b33b9dcf 100644 --- a/backend/pashub_fetcher/pashub_service.py +++ b/backend/pashub_fetcher/pashub_service.py @@ -71,9 +71,15 @@ class PashubService: else: logger.info(f"No UPRN found for job {job_id}") - job_files: List[str] = active_client.get_core_evidence_files_by_job_id( - job_id - ) + try: + job_files: List[str] = active_client.get_core_evidence_files_by_job_id( + job_id + ) + except UnauthorizedError: + if active_client is not self._pashub_client: + raise + active_client = self._get_coordination_client() + job_files = active_client.get_core_evidence_files_by_job_id(job_id) if uprn or hubspot_deal_id: logger.info("Uploading files to s3")