fix(linkedin): resolve issue where locaion is null

pull/12/head
Cullen Watson 2023-07-08 21:16:34 -05:00
parent 0da7ea59d0
commit 405842f90e
4 changed files with 8 additions and 7 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
/.idea /.idea
.DS_Store **/.DS_Store
/venv/ /venv/
/ven/ /ven/
**/__pycache__/ **/__pycache__/

View File

@ -15,8 +15,8 @@ class JobType(Enum):
class Location(BaseModel): class Location(BaseModel):
country: str country: str
city: str city: str = None
state: str state: str = None
postal_code: str = None postal_code: str = None
address: str = None address: str = None

View File

@ -78,6 +78,9 @@ class LinkedInScraper(Scraper):
@staticmethod @staticmethod
def get_location(metadata_card): def get_location(metadata_card):
location = Location(
country="US",
)
if metadata_card is not None: if metadata_card is not None:
location_tag = metadata_card.find( location_tag = metadata_card.find(
"span", class_="job-search-card__location" "span", class_="job-search-card__location"

View File

@ -9,9 +9,7 @@ router = APIRouter(prefix="/jobs")
@router.get("/") @router.get("/")
async def scrape_jobs( async def scrape_jobs(site_type: str, search_term: str, location: str, page: int = 1):
site_type: str, search_term: str, location: str, page: int = None
):
job_response = {"message": "site type not found"} job_response = {"message": "site type not found"}
scraper_dict = { scraper_dict = {