Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,20 +3,22 @@ import requests
|
|
| 3 |
|
| 4 |
def search_jobs_ui(query, location):
|
| 5 |
"""
|
| 6 |
-
Searches job listings using the Indeed API and formats the results.
|
| 7 |
-
|
| 8 |
Args:
|
| 9 |
query (str): Job title or keyword to search for.
|
| 10 |
location (str): Location for the job search.
|
| 11 |
-
|
| 12 |
Returns:
|
| 13 |
str: Markdown-formatted string of job results or error message.
|
| 14 |
"""
|
| 15 |
-
url =
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
try:
|
| 19 |
-
response = requests.get(url,
|
| 20 |
response.raise_for_status()
|
| 21 |
result = response.json()
|
| 22 |
except requests.exceptions.RequestException as e:
|
|
@@ -44,9 +46,9 @@ app = gr.Interface(
|
|
| 44 |
gr.Textbox(label="Location")
|
| 45 |
],
|
| 46 |
outputs="markdown",
|
| 47 |
-
title="Indeed Job Search
|
| 48 |
-
description="Search job listings using
|
| 49 |
)
|
| 50 |
|
| 51 |
if __name__ == "__main__":
|
| 52 |
-
app.launch(share=True
|
|
|
|
| 3 |
|
| 4 |
def search_jobs_ui(query, location):
|
| 5 |
"""
|
| 6 |
+
Searches job listings using the Indeed Jobs API and formats the results.
|
|
|
|
| 7 |
Args:
|
| 8 |
query (str): Job title or keyword to search for.
|
| 9 |
location (str): Location for the job search.
|
|
|
|
| 10 |
Returns:
|
| 11 |
str: Markdown-formatted string of job results or error message.
|
| 12 |
"""
|
| 13 |
+
url = "https://indeed-api.services/api/v1/jobs" # Example public endpoint (confirm from docs)
|
| 14 |
+
params = {
|
| 15 |
+
"q": query,
|
| 16 |
+
"l": location,
|
| 17 |
+
"limit": 5
|
| 18 |
+
}
|
| 19 |
|
| 20 |
try:
|
| 21 |
+
response = requests.get(url, params=params)
|
| 22 |
response.raise_for_status()
|
| 23 |
result = response.json()
|
| 24 |
except requests.exceptions.RequestException as e:
|
|
|
|
| 46 |
gr.Textbox(label="Location")
|
| 47 |
],
|
| 48 |
outputs="markdown",
|
| 49 |
+
title="Indeed Job Search",
|
| 50 |
+
description="Search job listings using the Indeed Jobs API."
|
| 51 |
)
|
| 52 |
|
| 53 |
if __name__ == "__main__":
|
| 54 |
+
app.launch(share=True)
|