remove postal code (#17)

* fix: remove postal code
This commit is contained in:
Cullen Watson
2023-08-26 22:09:04 -05:00
committed by GitHub
parent d72d14db02
commit 33f6768ec8
6 changed files with 13 additions and 21 deletions

View File

@@ -19,11 +19,9 @@ class JobType(Enum):
class Location(BaseModel):
country: str
country: str = "USA"
city: str = None
state: str = None
postal_code: str = None
address: str = None
class CompensationInterval(Enum):
@@ -38,7 +36,7 @@ class Compensation(BaseModel):
interval: CompensationInterval
min_amount: float
max_amount: float
currency: str = "US"
currency: str = "USA"
class JobPost(BaseModel):

View File

@@ -125,7 +125,6 @@ class IndeedScraper(Scraper):
city=job.get("jobLocationCity"),
state=job.get("jobLocationState"),
postal_code=job.get("jobLocationPostal"),
country="US",
),
job_type=job_type,
compensation=compensation,

View File

@@ -167,9 +167,6 @@ class LinkedInScraper(Scraper):
:param metadata_card
:return: location
"""
location = Location(
country="US",
)
if metadata_card is not None:
location_tag = metadata_card.find(
"span", class_="job-search-card__location"
@@ -179,7 +176,6 @@ class LinkedInScraper(Scraper):
if len(parts) == 2:
city, state = parts
location = Location(
country="US",
city=city,
state=state,
)

View File

@@ -292,7 +292,6 @@ class ZipRecruiterScraper(Scraper):
else:
city, state = None, None
return Location(
country="US",
city=city,
state=state,
)

View File

@@ -23,6 +23,7 @@ async def scrape_jobs(scraper_input: ScraperInput) -> Dict[str, JobResponse]:
:param scraper_input:
:return: Dict[str, JobResponse]: where each key is a site
"""
def scrape_site(site: Site) -> Tuple[str, JobResponse]:
scraper_class = SCRAPER_MAPPING[site]
scraper = scraper_class()
@@ -30,7 +31,9 @@ async def scrape_jobs(scraper_input: ScraperInput) -> Dict[str, JobResponse]:
return (site.value, scraped_data)
with ThreadPoolExecutor() as executor:
resp_dict = {site: resp for site, resp in executor.map(scrape_site, scraper_input.site_type)}
resp_dict = {
site: resp
for site, resp in executor.map(scrape_site, scraper_input.site_type)
}
return resp_dict