- new schema (includes bugs)

pull/31/head
Zachary Hampton 2023-09-02 15:17:01 -07:00
parent ad8b27ac00
commit 8c7d924a85
9 changed files with 23 additions and 14 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@
**/__pycache__/
*.pyc
.env
client_secret.json
client_secret.json
dist

View File

@ -7,12 +7,11 @@ from .core.scrapers import (
ScraperInput,
Site,
JobResponse,
CommonResponse,
)
import pandas as pd
from .core.jobs import JobType
from typing import List, Dict, Tuple, Union
from typing import List, Tuple
SCRAPER_MAPPING = {
Site.LINKEDIN: LinkedInScraper,
@ -49,13 +48,17 @@ def scrape_jobs(
site_type=site_type,
search_term=search_term,
location=location,
distance=distance,
is_remote=is_remote,
job_type=job_type,
easy_apply=easy_apply,
results_wanted=results_wanted,
)
if distance:
scraper_input.distance = distance
if job_type:
scraper_input.job_type = job_type
def scrape_site(site: Site) -> Tuple[str, JobResponse]:
scraper_class = SCRAPER_MAPPING[site]
scraper = scraper_class()

View File

@ -21,8 +21,8 @@ class JobType(Enum):
class Location(BaseModel):
country: str = "USA"
city: str = None
state: str = None
city: str = ""
state: str = ""
class CompensationInterval(Enum):

View File

@ -127,15 +127,20 @@ class IndeedScraper(Scraper):
description=description,
company_name=job["company"],
location=Location(
city=job.get("jobLocationCity"),
state=job.get("jobLocationState"),
postal_code=job.get("jobLocationPostal"),
city=job.get("jobLocationCity", ""),
state=job.get("jobLocationState", ""),
postal_code=job.get("jobLocationPostal", ""),
),
job_type=job_type,
compensation=compensation,
date_posted=date_posted,
job_url=job_url_client,
)
if compensation:
job_post.compensation = compensation
if job_type:
job_post.job_type = job_type
return job_post
for job in jobs["metaData"]["mosaicProviderJobCardsModel"]["results"]:

View File

@ -1,4 +1,4 @@
from src import scrape_jobs
from src.jobspy import scrape_jobs
def test_indeed():

View File

@ -1,4 +1,4 @@
from src import scrape_jobs
from src.jobspy import scrape_jobs
def test_ziprecruiter():