-
Notifications
You must be signed in to change notification settings - Fork 0
/
job_api.py
34 lines (28 loc) · 931 Bytes
/
job_api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import requests
def fetch_job_listings(keyword, location):
# Example API endpoint (replace with actual job API)
api_url = f"https://api.example.com/jobs?keyword={keyword}&location={location}"
response = requests.get(api_url)
if response.status_code == 200:
jobs = response.json()
return jobs
else:
print("Failed to fetch job listings")
return []
def display_jobs(jobs):
for job in jobs:
print(f"Title: {job['title']}")
print(f"Company: {job['company']}")
print(f"Location: {job['location']}")
print(f"Description: {job['description']}")
print("-" * 40)
def main():
keyword = input("Enter job keyword: ")
location = input("Enter job location: ")
jobs = fetch_job_listings(keyword, location)
if jobs:
display_jobs(jobs)
else:
print("No jobs found")
if __name__ == "__main__":
main()