Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -95,11 +95,13 @@ book_interest_references = create_embedding_dict('Interested Type of Books')
|
|
| 95 |
import requests
|
| 96 |
|
| 97 |
def fetch_job_listings(job_title):
|
| 98 |
-
url = "https://jobs-
|
| 99 |
|
| 100 |
-
|
| 101 |
-
"
|
| 102 |
-
"
|
|
|
|
|
|
|
| 103 |
}
|
| 104 |
|
| 105 |
headers = {
|
|
@@ -107,21 +109,22 @@ def fetch_job_listings(job_title):
|
|
| 107 |
"X-RapidAPI-Host": "active-jobs-db.p.rapidapi.com"
|
| 108 |
}
|
| 109 |
|
| 110 |
-
response = requests.get(url, headers=headers, params=
|
| 111 |
job_data = response.json()
|
| 112 |
|
| 113 |
-
print("RAW RESPONSE:", job_data)
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
job.get("
|
| 121 |
-
job.get("
|
| 122 |
-
job.get("
|
|
|
|
| 123 |
])
|
| 124 |
-
return
|
| 125 |
else:
|
| 126 |
return [["No job listings", "found", "for this", "career path"]]
|
| 127 |
|
|
|
|
| 95 |
import requests
|
| 96 |
|
| 97 |
def fetch_job_listings(job_title):
|
| 98 |
+
url = "https://active-jobs-db.p.rapidapi.com/active-ats-7d"
|
| 99 |
|
| 100 |
+
params = {
|
| 101 |
+
"limit": "10",
|
| 102 |
+
"title_filter": job_title,
|
| 103 |
+
"location_filter": "India",
|
| 104 |
+
"description_type": "text"
|
| 105 |
}
|
| 106 |
|
| 107 |
headers = {
|
|
|
|
| 109 |
"X-RapidAPI-Host": "active-jobs-db.p.rapidapi.com"
|
| 110 |
}
|
| 111 |
|
| 112 |
+
response = requests.get(url, headers=headers, params=params)
|
| 113 |
job_data = response.json()
|
| 114 |
|
| 115 |
+
print("RAW RESPONSE:", job_data)
|
| 116 |
|
| 117 |
+
# ✅ Active Jobs DB returns a LIST, not dict
|
| 118 |
+
if isinstance(job_data, list) and len(job_data) > 0:
|
| 119 |
+
jobs = []
|
| 120 |
+
for job in job_data[:5]:
|
| 121 |
+
jobs.append([
|
| 122 |
+
job.get("title", "N/A"),
|
| 123 |
+
job.get("organization", "N/A"),
|
| 124 |
+
job.get("location", "N/A"),
|
| 125 |
+
job.get("salary_raw", "Not specified")
|
| 126 |
])
|
| 127 |
+
return jobs
|
| 128 |
else:
|
| 129 |
return [["No job listings", "found", "for this", "career path"]]
|
| 130 |
|