mirror of https://github.com/Bunsly/JobSpy
Added backend capabilities
parent
6f1490458c
commit
7f43b21d05
|
@ -1,4 +1,5 @@
|
||||||
/venv/
|
/venv/
|
||||||
|
/env/
|
||||||
/.idea
|
/.idea
|
||||||
**/__pycache__/
|
**/__pycache__/
|
||||||
**/.pytest_cache/
|
**/.pytest_cache/
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"python.analysis.extraPaths": [
|
||||||
|
"./src"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
from flask import Flask, jsonify, request
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
# Initialize the Flask application
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
# Get the absolute path of the src directory
|
||||||
|
src_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))
|
||||||
|
|
||||||
|
import csv
|
||||||
|
# Add src to the system path
|
||||||
|
if src_path not in sys.path:
|
||||||
|
sys.path.append(src_path)
|
||||||
|
|
||||||
|
from jobspy import scrape_jobs
|
||||||
|
|
||||||
|
@app.route('/Recommend_jobs', methods=['GET'])
|
||||||
|
def get_jobs():
|
||||||
|
# Get parameters from the request
|
||||||
|
site_name = request.args.getlist('site_name') or ["indeed"]
|
||||||
|
search_term = request.args.get('search_term') or "software engineer"
|
||||||
|
location = request.args.get('location') or "Dallas, TX"
|
||||||
|
results_wanted = int(request.args.get('results_wanted', 3))
|
||||||
|
hours_old = int(request.args.get('hours_old', 72))
|
||||||
|
country_indeed = request.args.get('country_indeed') or 'USA'
|
||||||
|
|
||||||
|
# Scrape the job data
|
||||||
|
jobs = scrape_jobs(
|
||||||
|
site_name=site_name,
|
||||||
|
search_term=search_term,
|
||||||
|
location=location,
|
||||||
|
results_wanted=results_wanted,
|
||||||
|
hours_old=hours_old,
|
||||||
|
country_indeed=country_indeed
|
||||||
|
)
|
||||||
|
|
||||||
|
# Convert jobs to a list of dictionaries
|
||||||
|
jobs_dict_list = jobs.to_dict(orient='records')
|
||||||
|
|
||||||
|
# Return the JSON response
|
||||||
|
return jsonify(jobs_dict_list)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# Run the Flask app
|
||||||
|
app.run(debug=True)
|
|
@ -0,0 +1,21 @@
|
||||||
|
annotated-types==0.7.0
|
||||||
|
beautifulsoup4==4.12.3
|
||||||
|
certifi==2024.8.30
|
||||||
|
charset-normalizer==3.3.2
|
||||||
|
idna==3.8
|
||||||
|
markdownify==0.11.6
|
||||||
|
numpy==1.26.3
|
||||||
|
pandas==2.2.2
|
||||||
|
pydantic==2.8.2
|
||||||
|
pydantic_core==2.20.1
|
||||||
|
python-dateutil==2.9.0.post0
|
||||||
|
python-jobspy==1.1.65
|
||||||
|
pytz==2024.1
|
||||||
|
regex==2024.7.24
|
||||||
|
requests==2.32.3
|
||||||
|
six==1.16.0
|
||||||
|
soupsieve==2.6
|
||||||
|
tls-client==1.0.1
|
||||||
|
typing_extensions==4.12.2
|
||||||
|
tzdata==2024.1
|
||||||
|
urllib3==2.2.2
|
Loading…
Reference in New Issue