Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Misc semantic changes in scrape_grades
Browse files Browse the repository at this point in the history
Also adds SSL verification back to scrape_grades.fetch_page_data
  • Loading branch information
gannonprudhomme committed Mar 22, 2020
1 parent 12ae93c commit 463c1e6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions autoscheduler/scraper/management/commands/scrape_grades.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,19 @@ def scrape_pdf(grade_dists: List[pdf_parser.GradeData], term: str) -> List[Grade
)

# Increment how many grades for this department were scraped
counts[grade_data.dept] = counts[grade_data.dept] + 1
counts[dept] += 1

# Create the grade model and add it to the list of models to be returned
grade = Grades(section=section, gpa=grade_data.gpa,
**grade_data.letter_grades)

scraped_grades.append(grade)

except ObjectDoesNotExist:
except Section.DoesNotExist:
print((f"Section couldn't be found for {term} {grade_data.dept}-"
f"{grade_data.course_num} {grade_data.section_num}"))

if len(counts.items()) == 0:
if not counts:
print(f"No grades scraped")

for dept, count in counts.items():
Expand Down Expand Up @@ -220,8 +220,7 @@ def fetch_page_data() -> bs4.BeautifulSoup:
so we can parse it to get the available years & colleges to scrape grades for
"""

# TODO Add SSL certification
response = requests.get(ROOT_URL, verify=False)
response = requests.get(ROOT_URL, verify=True)
response.raise_for_status()

soup = bs4.BeautifulSoup(response.text, "lxml")
Expand Down

0 comments on commit 463c1e6

Please sign in to comment.