Spaces:
Runtime error
Runtime error
bug fix
Browse files- main.py +8 -7
- scrape_onet.py +11 -11
- templates/job_list.html +7 -8
main.py
CHANGED
@@ -123,13 +123,13 @@ def post_job(request: Request, bt: BackgroundTasks, jobtitle: str = Form(enum=[x
|
|
123 |
jobdescription = get_onet_description(onetCode)
|
124 |
tasks = get_onet_tasks(onetCode)
|
125 |
activities = get_onet_activities(onetCode)
|
126 |
-
|
127 |
skills = get_onet_skills(onetCode)
|
128 |
knowledge = get_onet_knowledge(onetCode)
|
129 |
abilities = get_onet_abilities(onetCode)
|
130 |
interests = get_onet_interests(onetCode)
|
131 |
-
values = get_onet_values(onetCode)
|
132 |
-
styles = get_onet_styles(onetCode)
|
133 |
|
134 |
bt.add_task(neighborhoods, jobtitle)
|
135 |
return templates.TemplateResponse('job_list.html', context={
|
@@ -139,13 +139,14 @@ def post_job(request: Request, bt: BackgroundTasks, jobtitle: str = Form(enum=[x
|
|
139 |
'jobdescription': jobdescription,
|
140 |
'tasks': tasks,
|
141 |
'activities': activities,
|
142 |
-
'
|
143 |
'knowledge': knowledge,
|
144 |
'abilities': abilities,
|
145 |
'skills': skills,
|
146 |
-
'interests': interests
|
147 |
-
'values': values,
|
148 |
-
'styles': styles
|
|
|
149 |
|
150 |
### JOB NEIGHBORHOODS ###
|
151 |
@app.get("/explore-job-neighborhoods/", response_class=HTMLResponse)
|
|
|
123 |
jobdescription = get_onet_description(onetCode)
|
124 |
tasks = get_onet_tasks(onetCode)
|
125 |
activities = get_onet_activities(onetCode)
|
126 |
+
conditions = get_onet_context(onetCode)
|
127 |
skills = get_onet_skills(onetCode)
|
128 |
knowledge = get_onet_knowledge(onetCode)
|
129 |
abilities = get_onet_abilities(onetCode)
|
130 |
interests = get_onet_interests(onetCode)
|
131 |
+
#values = get_onet_values(onetCode)
|
132 |
+
#styles = get_onet_styles(onetCode)
|
133 |
|
134 |
bt.add_task(neighborhoods, jobtitle)
|
135 |
return templates.TemplateResponse('job_list.html', context={
|
|
|
139 |
'jobdescription': jobdescription,
|
140 |
'tasks': tasks,
|
141 |
'activities': activities,
|
142 |
+
'conditions': conditions,
|
143 |
'knowledge': knowledge,
|
144 |
'abilities': abilities,
|
145 |
'skills': skills,
|
146 |
+
'interests': interests #,
|
147 |
+
#'values': values,
|
148 |
+
#'styles': styles
|
149 |
+
})
|
150 |
|
151 |
### JOB NEIGHBORHOODS ###
|
152 |
@app.get("/explore-job-neighborhoods/", response_class=HTMLResponse)
|
scrape_onet.py
CHANGED
@@ -17,7 +17,7 @@ def get_onet_code(jobtitle):
|
|
17 |
|
18 |
def get_onet_description(onetCode):
|
19 |
url = "https://www.onetonline.org/link/summary/" + onetCode
|
20 |
-
response = requests.get(url, headers=headers)
|
21 |
soup = BeautifulSoup(response.text, 'html.parser')
|
22 |
jobdescription = soup.p.get_text()
|
23 |
return jobdescription
|
@@ -25,7 +25,7 @@ def get_onet_description(onetCode):
|
|
25 |
def get_onet_tasks(onetCode):
|
26 |
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15'}
|
27 |
url = "https://www.onetonline.org/link/result/" + onetCode + "?c=tk&n_tk=0&s_tk=IM&c_tk=0"
|
28 |
-
response = requests.get(url, headers=headers)
|
29 |
soup = BeautifulSoup(response.text, 'html.parser')
|
30 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
31 |
tasks = clean(tasks)
|
@@ -41,7 +41,7 @@ def get_onet_activities(onetCode):
|
|
41 |
|
42 |
activities_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=wa&n_wa=0&s_wa=IM&c_wa=0"
|
43 |
|
44 |
-
response = requests.get(activities_url, headers=headers)
|
45 |
soup = BeautifulSoup(response.text, 'html.parser')
|
46 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
47 |
tasks = clean(tasks)
|
@@ -64,7 +64,7 @@ def get_onet_context(onetCode):
|
|
64 |
|
65 |
context_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=cx&n_cx=0&c_cx=0&s_cx=n"
|
66 |
|
67 |
-
response = requests.get(context_url, headers=headers)
|
68 |
soup = BeautifulSoup(response.text, 'html.parser')
|
69 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
70 |
tasks = clean(tasks)
|
@@ -87,7 +87,7 @@ def get_onet_skills(onetCode):
|
|
87 |
|
88 |
skills_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=sk&n_sk=0&s_sk=IM&c_sk=0"
|
89 |
|
90 |
-
response = requests.get(skills_url, headers=headers)
|
91 |
soup = BeautifulSoup(response.text, 'html.parser')
|
92 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
93 |
tasks = clean(tasks)
|
@@ -110,7 +110,7 @@ def get_onet_knowledge(onetCode):
|
|
110 |
|
111 |
knowledge_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=kn&n_kn=0&s_kn=IM&c_kn=0"
|
112 |
|
113 |
-
response = requests.get(knowledge_url, headers=headers)
|
114 |
soup = BeautifulSoup(response.text, 'html.parser')
|
115 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
116 |
tasks = clean(tasks)
|
@@ -133,7 +133,7 @@ def get_onet_abilities(onetCode):
|
|
133 |
|
134 |
abilities_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=ab&n_ab=0&s_ab=IM&c_ab=0"
|
135 |
|
136 |
-
response = requests.get(abilities_url, headers=headers)
|
137 |
soup = BeautifulSoup(response.text, 'html.parser')
|
138 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
139 |
tasks = clean(tasks)
|
@@ -156,7 +156,7 @@ def get_onet_interests(onetCode):
|
|
156 |
|
157 |
interests_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=in&c_in=0"
|
158 |
|
159 |
-
response = requests.get(interests_url, headers=headers)
|
160 |
soup = BeautifulSoup(response.text, 'html.parser')
|
161 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
162 |
tasks = clean(tasks)
|
@@ -179,7 +179,7 @@ def get_onet_values(onetCode):
|
|
179 |
|
180 |
values_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=wv&c_wv=0"
|
181 |
|
182 |
-
response = requests.get(values_url, headers=headers)
|
183 |
soup = BeautifulSoup(response.text, 'html.parser')
|
184 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
185 |
tasks = clean(tasks)
|
@@ -202,7 +202,7 @@ def get_onet_styles(onetCode):
|
|
202 |
|
203 |
style_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=ws&n_ws=0&c_ws=0"
|
204 |
|
205 |
-
response = requests.get(style_url, headers=headers)
|
206 |
soup = BeautifulSoup(response.text, 'html.parser')
|
207 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
208 |
tasks = clean(tasks)
|
@@ -223,7 +223,7 @@ def get_onet_styles(onetCode):
|
|
223 |
def get_job_postings(onetCode, state):
|
224 |
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15'}
|
225 |
url = "https://www.onetonline.org/link/localjobs/" + onetCode + "?st=" + state
|
226 |
-
response = requests.get(url, headers=headers)
|
227 |
soup = BeautifulSoup(response.text, 'html.parser')
|
228 |
jobs = str(soup.get_text("tbody")).split('PostedtbodyTitle and CompanytbodyLocation')[1].split('Sources:')[0].split("tbody")
|
229 |
jobs = jobs[5:45]
|
|
|
17 |
|
18 |
def get_onet_description(onetCode):
|
19 |
url = "https://www.onetonline.org/link/summary/" + onetCode
|
20 |
+
response = requests.get(url, headers=headers, verify=False)
|
21 |
soup = BeautifulSoup(response.text, 'html.parser')
|
22 |
jobdescription = soup.p.get_text()
|
23 |
return jobdescription
|
|
|
25 |
def get_onet_tasks(onetCode):
|
26 |
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15'}
|
27 |
url = "https://www.onetonline.org/link/result/" + onetCode + "?c=tk&n_tk=0&s_tk=IM&c_tk=0"
|
28 |
+
response = requests.get(url, headers=headers, verify=False)
|
29 |
soup = BeautifulSoup(response.text, 'html.parser')
|
30 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
31 |
tasks = clean(tasks)
|
|
|
41 |
|
42 |
activities_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=wa&n_wa=0&s_wa=IM&c_wa=0"
|
43 |
|
44 |
+
response = requests.get(activities_url, headers=headers, verify=False)
|
45 |
soup = BeautifulSoup(response.text, 'html.parser')
|
46 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
47 |
tasks = clean(tasks)
|
|
|
64 |
|
65 |
context_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=cx&n_cx=0&c_cx=0&s_cx=n"
|
66 |
|
67 |
+
response = requests.get(context_url, headers=headers, verify=False)
|
68 |
soup = BeautifulSoup(response.text, 'html.parser')
|
69 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
70 |
tasks = clean(tasks)
|
|
|
87 |
|
88 |
skills_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=sk&n_sk=0&s_sk=IM&c_sk=0"
|
89 |
|
90 |
+
response = requests.get(skills_url, headers=headers, verify=False)
|
91 |
soup = BeautifulSoup(response.text, 'html.parser')
|
92 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
93 |
tasks = clean(tasks)
|
|
|
110 |
|
111 |
knowledge_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=kn&n_kn=0&s_kn=IM&c_kn=0"
|
112 |
|
113 |
+
response = requests.get(knowledge_url, headers=headers, verify=False)
|
114 |
soup = BeautifulSoup(response.text, 'html.parser')
|
115 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
116 |
tasks = clean(tasks)
|
|
|
133 |
|
134 |
abilities_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=ab&n_ab=0&s_ab=IM&c_ab=0"
|
135 |
|
136 |
+
response = requests.get(abilities_url, headers=headers, verify=False)
|
137 |
soup = BeautifulSoup(response.text, 'html.parser')
|
138 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
139 |
tasks = clean(tasks)
|
|
|
156 |
|
157 |
interests_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=in&c_in=0"
|
158 |
|
159 |
+
response = requests.get(interests_url, headers=headers, verify=False)
|
160 |
soup = BeautifulSoup(response.text, 'html.parser')
|
161 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
162 |
tasks = clean(tasks)
|
|
|
179 |
|
180 |
values_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=wv&c_wv=0"
|
181 |
|
182 |
+
response = requests.get(values_url, headers=headers, verify=False)
|
183 |
soup = BeautifulSoup(response.text, 'html.parser')
|
184 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
185 |
tasks = clean(tasks)
|
|
|
202 |
|
203 |
style_url = "https://www.onetonline.org/link/result/" + onetCode + "?c=ws&n_ws=0&c_ws=0"
|
204 |
|
205 |
+
response = requests.get(style_url, headers=headers, verify=False)
|
206 |
soup = BeautifulSoup(response.text, 'html.parser')
|
207 |
tasks = str(soup.get_text('reportsubdesc')).replace("reportsubdesc", " ").replace("ImportanceCategoryTask ", "")
|
208 |
tasks = clean(tasks)
|
|
|
223 |
def get_job_postings(onetCode, state):
|
224 |
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15'}
|
225 |
url = "https://www.onetonline.org/link/localjobs/" + onetCode + "?st=" + state
|
226 |
+
response = requests.get(url, headers=headers, verify=False)
|
227 |
soup = BeautifulSoup(response.text, 'html.parser')
|
228 |
jobs = str(soup.get_text("tbody")).split('PostedtbodyTitle and CompanytbodyLocation')[1].split('Sources:')[0].split("tbody")
|
229 |
jobs = jobs[5:45]
|
templates/job_list.html
CHANGED
@@ -54,13 +54,13 @@
|
|
54 |
</ul>
|
55 |
</section>
|
56 |
{% endif %}
|
57 |
-
{% if
|
58 |
<section>
|
59 |
<h1 class="sectiontitle">Other Work Activities:</h1>
|
60 |
<p class="sectiontext">{{ activities }}</p>
|
61 |
</section>
|
62 |
{% endif %}
|
63 |
-
{% if
|
64 |
<section>
|
65 |
<h1 class="sectiontitle">Work Conditions:</h1>
|
66 |
<p class="sectiontext">{{ conditions }}</p>
|
@@ -73,8 +73,7 @@
|
|
73 |
</section>
|
74 |
{% endif %}
|
75 |
{% if jobtitle %}
|
76 |
-
<h1 class="pagesubtitle">About the Qualified
|
77 |
-
<h1 class="pagesubtitle">We're sorry! This section is currently under construction. Please check back soon to see the characteristics necessary to be great {{ jobtitle }}.</h1>
|
78 |
{% endif %}
|
79 |
{% if preparation %}
|
80 |
<section>
|
@@ -82,25 +81,25 @@
|
|
82 |
<p class="sectiontext">{{ preparation }}</p>
|
83 |
</section>
|
84 |
{% endif %}
|
85 |
-
{% if
|
86 |
<section>
|
87 |
<h1 class="sectiontitle">Knows About:</h1>
|
88 |
<p class="sectiontext">{{ knowledge }}</p>
|
89 |
</section>
|
90 |
{% endif %}
|
91 |
-
{% if
|
92 |
<section>
|
93 |
<h1 class="sectiontitle">Is Skilled at:</h1>
|
94 |
<p class="sectiontext">{{ skills }}</p>
|
95 |
</section>
|
96 |
{% endif %}
|
97 |
-
{% if
|
98 |
<section>
|
99 |
<h1 class="sectiontitle">Is Able to:</h1>
|
100 |
<p class="sectiontext">{{ abilities }}</p>
|
101 |
</section>
|
102 |
{% endif %}
|
103 |
-
{% if
|
104 |
<section>
|
105 |
<h1 class="sectiontitle">Is Interested in:</h1>
|
106 |
<p class="sectiontext">{{ interests }}</p>
|
|
|
54 |
</ul>
|
55 |
</section>
|
56 |
{% endif %}
|
57 |
+
{% if jobtitle %}
|
58 |
<section>
|
59 |
<h1 class="sectiontitle">Other Work Activities:</h1>
|
60 |
<p class="sectiontext">{{ activities }}</p>
|
61 |
</section>
|
62 |
{% endif %}
|
63 |
+
{% if jobtitle %}
|
64 |
<section>
|
65 |
<h1 class="sectiontitle">Work Conditions:</h1>
|
66 |
<p class="sectiontext">{{ conditions }}</p>
|
|
|
73 |
</section>
|
74 |
{% endif %}
|
75 |
{% if jobtitle %}
|
76 |
+
<h1 class="pagesubtitle">About the Qualified Applicant</h1>
|
|
|
77 |
{% endif %}
|
78 |
{% if preparation %}
|
79 |
<section>
|
|
|
81 |
<p class="sectiontext">{{ preparation }}</p>
|
82 |
</section>
|
83 |
{% endif %}
|
84 |
+
{% if jobtitle %}
|
85 |
<section>
|
86 |
<h1 class="sectiontitle">Knows About:</h1>
|
87 |
<p class="sectiontext">{{ knowledge }}</p>
|
88 |
</section>
|
89 |
{% endif %}
|
90 |
+
{% if jobtitle %}
|
91 |
<section>
|
92 |
<h1 class="sectiontitle">Is Skilled at:</h1>
|
93 |
<p class="sectiontext">{{ skills }}</p>
|
94 |
</section>
|
95 |
{% endif %}
|
96 |
+
{% if jobtitle %}
|
97 |
<section>
|
98 |
<h1 class="sectiontitle">Is Able to:</h1>
|
99 |
<p class="sectiontext">{{ abilities }}</p>
|
100 |
</section>
|
101 |
{% endif %}
|
102 |
+
{% if jobtitle %}
|
103 |
<section>
|
104 |
<h1 class="sectiontitle">Is Interested in:</h1>
|
105 |
<p class="sectiontext">{{ interests }}</p>
|