Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions powerapi/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,36 @@ 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'<h1>Grades and Attendance: (.*?)</h1>', 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'<div id="print-school">(.*?)<br>', self.homeContents, re.S)

return name.groups()[0].strip()

def getSchoolName(self):
name = re.search(r'<div id="print-school">.*?<br><span>(.*?)</span></div>', self.homeContents, re.S)

return name.groups()[0].strip()

def getUserName(self):
name = re.search(r'<li id="userName" .*?<span>(.*?)<\/span>', self.homeContents, re.S)

return name.groups()[0].strip()

def getCourses(self):
return self.courses
return self.courses