-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
33 lines (25 loc) · 959 Bytes
/
app.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
# imports
from flask import Flask, render_template, request, send_file, Response
from wtforms import Form, TextField, StringField, SubmitField
from jobscraper import extract_job, generate_url, extract_data, transform_data, get_next_page, save_to_xlsx, to_aws
app = Flask(__name__)
app.config['WTF_CSRF_ENABLED'] = False # Sensitive
# input form
class Form(Form):
keyword = TextField('What')
location = TextField('Where')
# home page
@app.route('/')
def index():
form = Form(request.form)
return render_template('index.html', form=form)
# results page
@app.route('/results', methods=('GET', 'POST'))
def search_resluts():
if request.method == 'POST':
keyword = request.form['keyword']
location = request.form['location']
number_of_jobs = extract_job(keyword, location)
return render_template('job.html', length = number_of_jobs, keyword = keyword , location = location)
if __name__=='__main__':
app.run(debug=True)