ps.py documentation¶
ps module¶
This module contains facility classes and functions to access PowerSchool and change the XML data into a more workable format.
- class ps.Connection¶
Creates a temporary browser that connects to PowerSchool using HTTP.
>>> conn = Connection() >>> conn.login('http://powerschool.ausd.net', '12345', 'password') True >>> student = conn.get_student() >>> student.first_name "Johnny" >>> student.gpa "2.5"
- close()¶
Closes the browser instance.
- error = None¶
(string) error message from PowerSchool
- get_student()¶
Note
Must be logged in to work.
Create a student from the login information.
- get_xml()¶
Note
Must be logged in to work.
Downloads the XML data from PowerSchool and returns its contents.
- logged_in = None¶
(bool) returns whether Connection was able to log in
- login(url, username, password)¶
Logs into url with credentials username and password.
Parameters: - url (string) – PowerSchool URL to login into. ex. http://powerschool.ausd.net/
- username (string) – PowerSchool username (usually a Student ID#)
- password (string) – PowerSchool password
Returns: True if login was successful. Otherwise, False.
- student = None¶
(Student) a Student from the Connection
- xml_data = None¶
(string) downloaded XML data
- class ps.Student(loadstring=None)¶
A Student is a data structure that holds:
Field Type Description first_name (string) First name last_name (string) Last name gender (string) Gender (Male/Female) gpa (string) Grade point average courses (course[]) Courses A course is a dictionary containing:
Field Type Description name (string) Course name teacher (string) Course teacher (LastName, FirstName) letter_grade (string) Letter grade received (A, B, C, etc.) number_grade (string) Number grade received (percentage) in_progress (bool) Sees if course is to be included assignments (assn[]) Assignments categories (string[]) Categories of assignments for course An assn (assignment) is a dictionary containing:
Field Type Description name (string) Assignment name category (string) Category of assignment (test, project, etc.) due_date (string) Due date (Month/Day/Year format) score (float) Score gotten on assignment out_of (float) Total amount of points possible Parameters: loadstring (string) – XML data to load Student info - courses = None¶
(course[]) Course list
- filter_courses(cutoff_date)¶
Sets each course’s in_progress attribute to True if it is between cutoff_date and today.
Parameters: cutoff_date (datetime.date) – Courses between this day (inclusive) will be included.
- first_name = None¶
(string) First name
- gender = None¶
(string) Gender
- gpa = None¶
(string) Grade point average
- last_name = None¶
(string) Last name
- load(loadstring)¶
Loads a Student with XML data received from loadstring.
Parameters: loadstring (string) – XML data to load Student from
- to_excel()¶
Note
Requires that the Student has been loaded.
Returns: Creates a xlwt Workbook of the Student’s grades.
- to_json()¶
Note
Requires that the Student has been loaded.
Returns: Student in JSON format.
- z_to_json(strength=9)¶
Note
Requires that the Student has been loaded.
Does the same thing as to_json, but compresses the information with maximum strength before returning it.