From 558e35293953d9a23cda9fff534be4b61699267a Mon Sep 17 00:00:00 2001 From: Cullen Watson Date: Thu, 21 Sep 2023 17:42:24 -0500 Subject: [PATCH] fix: job type param bug --- pyproject.toml | 2 +- src/jobspy/__init__.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1398b80..37fea7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "python-jobspy" -version = "1.1.4" +version = "1.1.5" description = "Job scraper for LinkedIn, Indeed & ZipRecruiter" authors = ["Zachary Hampton ", "Cullen Watson "] homepage = "https://github.com/cullenwatson/JobSpy" diff --git a/src/jobspy/__init__.py b/src/jobspy/__init__.py index 2569758..37e44f4 100644 --- a/src/jobspy/__init__.py +++ b/src/jobspy/__init__.py @@ -32,7 +32,7 @@ def scrape_jobs( location: str = "", distance: int = None, is_remote: bool = False, - job_type: JobType = None, + job_type: str = None, easy_apply: bool = False, # linkedin results_wanted: int = 15, country_indeed: str = "usa", @@ -44,6 +44,14 @@ def scrape_jobs( :return: results_wanted: pandas dataframe containing job data """ + def get_enum_from_value(value_str): + for job_type in JobType: + if value_str in job_type.value: + return job_type + raise Exception(f"Invalid job type: {value_str}") + job_type = get_enum_from_value(job_type) if job_type else None + + if type(site_name) == str: site_type = [_map_str_to_site(site_name)] else: #: if type(site_name) == list