ps.py

A PowerSchool authentication & data fetching library implemented in Python.

Download .zip Download .tar.gz View on GitHub

The heart of ScorePortal is its ability to automatically fetch grades from PowerSchool and to transform the information into a workable format. ps.py is a PowerSchool library inspired by ScorePortal and facilitates PowerSchool automation and XML parsing within Python.

Requirements

ps.py requires that the system have the mechanize and xlwt modules installed. You can easily install them through:

$ pip install mechanize

$ pip install xlwt

Example

This example shows how one can use ps.py to login to PowerSchool and fetch grades.

import ps

# Credentials
URL = 'http://powerschool.ausd.net/'
USERNAME = '12345'
PASSWORD = 'j83nl3a'

# Connect to PowerSchool
conn = ps.Connection()

# check if logged in
if conn.login(URL, USERNAME, PASSWORD):

    # get Student instance
    student = conn.get_student()

    # output a JSON file
    with open('12345.json', 'w') as file:
        file.write(student.to_json())

    # process info
    print "Hi there, " + student.first_name
    print "Your GPA: " + student.gpa
    print "Your classes:"

    for course in student.courses:
        print course.name, course.letter_grade, course.number_grade
        print "Assignments:"
        for assn in course.assignments:
            print assn.due_date, assn.category, assn.name

else:
    print 'Could not log in: ' + conn.error

# we're done, close the object.
conn.close()

API Reference

A complete API reference for this project is available in: