MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / fetch_jobs

Function fetch_jobs

web_programming/fetch_jobs.py:23–29  ·  view source on GitHub ↗
(location: str = "mumbai")

Source from the content-addressed store, hash-verified

21
22
23def fetch_jobs(location: str = "mumbai") -> Generator[tuple[str, str]]:
24 soup = BeautifulSoup(httpx.get(url + location, timeout=10).content, "html.parser")
25 # This attribute finds out all the specifics listed in a job
26 for job in soup.find_all("div", attrs={"data-tn-component": "organicJob"}):
27 job_title = job.find("a", attrs={"data-tn-element": "jobTitle"}).text.strip()
28 company_name = job.find("span", {"class": "company"}).text.strip()
29 yield job_title, company_name
30
31
32if __name__ == "__main__":

Callers 1

fetch_jobs.pyFile · 0.85

Calls 2

getMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected