def report(): word = request.args.get('word') location = request.args.get('location') searchKey = word +" in "+ location if searchKey: word = word.lower() location = location.lower() searchKey = searchKey.lower() existingJobs = db.get(searchKey) if existingJobs: jobs = existingJobs else: jobs = list(interleave([indeed_get_jobs(word, location),so_get_jobs(word, location)])) db[searchKey] = jobs else: return redirect("/") return render_template( "report.html", searchingBy=searchKey, word = word, location = location, resultsNumber=len(jobs), jobs=jobs )
def get_jobs(word): jobs = [] so_jobs = so_get_jobs(word) wework_jobs = wework_get_jobs(word) remoteok_jobs = remoteok_get_jobs(word) len(so_jobs) len(wework_jobs) len(remoteok_jobs) jobs = so_jobs + wework_jobs + remoteok_jobs return jobs
def report(): word = request.args.get('word') if word: word = word.lower() if not db.get(word): db[word] = so_get_jobs(word) + indeed_get_jobs(word) jobs = db[word] else: return redirect("/") return render_template("report.html", resultsNumber=len(jobs), searchingBy=word, jobs=jobs)
def report(): word = request.args.get("word") if word: #word==None 일때 lower안한다는 처리 word = word.lower() existing_jobs = db.get(word) if existing_jobs: jobs = existing_jobs else: jobs = wwr_get_jobs(word) + so_get_jobs(word) + re_get_jobs(word) db[word] = jobs else: return redirect("/") #입력없을시 못벗어남 return render_template("report.html", searching_by=word, resultsNumber=len(jobs), jobs=jobs)
def home(): jobs = [] word = request.args.get('word') if word: word = word.lower() print(word) existingjobs = db.get(word) if existingjobs: print("DB에 존재합니다") jobs = existingjobs else: try: jobs = wwr_get_jobs(word) + ro_get_jobs(word) + so_get_jobs(word) db[word] = jobs except: print(word, "는 올바르지 않은 키워드입니다.") return redirect("/") return render_template("index.html", word=word, jobs=jobs, resultsNumber=len(jobs))
def view(): wannajob = request.args.get('wannajob') if wannajob: wannajob = request.args.get('wannajob').lower() jobs = {} try: from_db = db.get(wannajob) if from_db: db[wannajob] = from_db else: jobs['so'] = so_get_jobs(wannajob) jobs['ro'] = remoteok_get_jobs(wannajob) jobs['wwr'] = wwr_get_jobs(wannajob) db[wannajob] = listappend(jobs['so'], jobs['ro'], jobs['wwr']) random.shuffle(db[wannajob]) return render_template('view.html', wannajob=wannajob, db=db) except: error = "Not found" return render_template('view.html', error=error) else: return redirect('/')
from headhunter import get_jobs as hh_get_jobs from so import get_jobs as so_get_jobs hh_jobs = hh_get_jobs() so_jobs = so_get_jobs() jobs = hh_jobs + so_jobs print(jobs)