From a4846a8c6f4ee10e33928305cf5aefb82067ad49 Mon Sep 17 00:00:00 2001 From: blackms Date: Wed, 11 Sep 2024 18:48:46 +0200 Subject: [PATCH] First version with one issue of test suite --- requirements.txt | 1 + src/linkedIn_easy_applier.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/requirements.txt b/requirements.txt index 11127a8..dedcfa3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,3 +23,4 @@ jsonschema-specifications==2023.12.1 httpx~=0.27.2 python-dotenv~=1.0.1 PyYAML~=6.0.2 +pytest>=8.3.3 diff --git a/src/linkedIn_easy_applier.py b/src/linkedIn_easy_applier.py index cf64245..1d734e8 100644 --- a/src/linkedIn_easy_applier.py +++ b/src/linkedIn_easy_applier.py @@ -76,6 +76,20 @@ class LinkedInEasyApplier: logger.error("Failed to return to job page after %d attempts. Cannot apply for the job.", max_attempts) raise Exception( f"Redirected to LinkedIn Premium page and failed to return after {max_attempts} attempts. Job application aborted.") + + def apply_to_job(self, job: Any) -> None: + """ + Starts the process of applying to a job. + :param job: A job object with the job details. + :return: None + """ + logger.debug(f"Applying to job: {job}") + try: + self.job_apply(job) + logger.info(f"Successfully applied to job: {job.title}") + except Exception as e: + logger.error(f"Failed to apply to job: {job.title}, error: {str(e)}") + raise e def job_apply(self, job: Any): logger.debug("Starting job application for job: %s", job)