From 435d966545c1a2c06d9ebcfe3d9115ba7c57de85 Mon Sep 17 00:00:00 2001 From: Jonathan Saewitz Date: Wed, 18 Nov 2015 11:15:38 -0500 Subject: [PATCH] add new methods add getName() and getSchoolName() methods, rename the previous getSchoolName() method to the more accurate getSchoolDistrictName() --- powerapi/user.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/powerapi/user.py b/powerapi/user.py index 325b742..b6d1f0d 100644 --- a/powerapi/user.py +++ b/powerapi/user.py @@ -17,10 +17,31 @@ def _createCourses(self): return courses - def getSchoolName(self): + def getName(self): + #get the name in format "Last, First Middle" from the page's html + name = re.search(r'

Grades and Attendance: (.*?)

', self.homeContents, re.S).groups()[0].strip() + + #get the last name + lastName = re.search(r'(.*), ', name).groups()[0].strip() + + #get the first name by removing the last name from the 'name' string + firstName = re.sub(r'(.*), ', '', name) + + #concatenate the first and last names + name = firstName + " " + lastName + + #return the name in the format "First Middle Last" + return name + + def getSchoolDistrictName(self): name = re.search(r'