halimbahae commited on
Commit
976c3d7
1 Parent(s): c20e759

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -31,14 +31,22 @@ def ats_friendly_checker(file):
31
  return feedback
32
 
33
  def scrape_job_description(url):
34
- response = requests.get(url)
35
- soup = BeautifulSoup(response.text, 'html.parser')
36
- job_description = soup.get_text(separator=" ", strip=True)
37
- return job_description
 
 
 
 
38
 
39
  def resume_match_checker(file, job_url):
40
  resume_text = extract_text_from_pdf(file)
41
  job_description = scrape_job_description(job_url)
 
 
 
 
42
  system_message = "Compare the following resume with the job description and provide feedback."
43
  message = f"Resume: {resume_text}\n\nJob Description: {job_description}"
44
  response = client.chat_completion(
 
31
  return feedback
32
 
33
  def scrape_job_description(url):
34
+ try:
35
+ response = requests.get(url)
36
+ response.raise_for_status()
37
+ soup = BeautifulSoup(response.text, 'html.parser')
38
+ job_description = soup.get_text(separator=" ", strip=True)
39
+ return job_description
40
+ except requests.exceptions.RequestException as e:
41
+ return f"Error accessing job description: {e}"
42
 
43
  def resume_match_checker(file, job_url):
44
  resume_text = extract_text_from_pdf(file)
45
  job_description = scrape_job_description(job_url)
46
+
47
+ if job_description.startswith("Error accessing job description:"):
48
+ return job_description
49
+
50
  system_message = "Compare the following resume with the job description and provide feedback."
51
  message = f"Resume: {resume_text}\n\nJob Description: {job_description}"
52
  response = client.chat_completion(