Git Product home page Git Product logo

powerschool's Introduction

PowerSchool

powerschool is a Python client for the PowerSchool SIS API

Table of Contents

Installation

Use the package manager pip to install powerschool.

pip install powerschool

Generate Client ID and Client Secret

You can collect the Client ID and Client Secret directly by signing into the PowerSchool Admin portal and navigating to System > System Settings > Plugin Management Dashboard > {Your Plugin}.

Getting Started

  1. Ensure you have a valid plugin installed with the proper data access provisioned for your purposes.

  2. Instantiate a client by passing the host name of your server and one form of authentication:

    • client credentials (tuple)
     import powerschool
    
     client_id = 'CLi3N7-Id'
     client_secret = 'cL13N7-53cR37'
     my_credentials = (client_id, client_secret)
    
     ps = powerschool.PowerSchool('my.host.name', auth=my_credentials)
    • access token (dict)
     import powerschool
    
     with open('/path/to/token_file.json', 'r') as f:
         my_token = json.load(f)
    
     ps = powerschool.PowerSchool('my.host.name', auth=my_token)

Usage

Refer to the docs for full functionality, including resources, searching, and pagination.

Instantiate a table or PowerQuery object:

schools_table = ps.get_schema_table('schools')

powerquery = ps.get_named_query('com.pearson.core.student.search.get_student_basic_info')

Get the record count for a table:

schools_table.count()

Query all records, all columns on a table:

Pagination is handled automatically by the client. However, you can manually pass pagesize and page parameters, should you choose.

schools_table.query()

Query all records on a table, with filter and columns list:

params = {
    'q': 'id=ge=10000',
    'projection': 'school_number,abbreviation',
}
schools_table.query(**params)

Query a specific record on a table:

schools_table.query(pk=123)

Execute a PowerQuery, passing arguments in the body:

payload = {
    'studentdcid': '5432',
}
powerquery.query(body=payload)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Notice

PowerSchool® is a registered trademark in the U.S. and/or other countries owned by PowerSchool Education, Inc. or its affiliates. PowerSchool® is used under license.

powerschool's People

Contributors

babikoffb avatar cbini avatar dependabot[bot] avatar pjpiwowarski avatar xrpza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

powerschool's Issues

Table names are... partially case-sensitive

There's some fairly weird behavior when trying to access tables with non-lowercase names. For example (where ps() returns a PowerSchool() instance):

>>> ps().get_schema_table('GradeScaleItem').query()
[None, None, None, ... (one for each row in GradeScaleItem)]

This appears to be happening because, while PowerSchool smiles tolerantly and returns the results you'd expect, the keys in its response are still all lowercase, as in:

{
    'name': 'GradeScaleItem',
    'record': [
        {
            'id': 1, 
            'tables': {'gradescaleitem': { (record keys/values) }}
        },
        ...
    ]
}

As a result, the second get() call at client.py:243 fails to find a match and returns None (because self.name differs from the result's value in case):

data.append(r.get("tables").get(self.name))

Whether this should be "fixed" by case-smashing the table name (self.name.lower() or so) and/or the keys in the result, or just documented in the future (when there exists documentation), I don't know.

Error

I would like to use this module to do work with PowerSchool. Giving it a test run I've ran into this error:

AttributeError: partially initialized module 'powerschool' has no attribute 'PowerSchool' (most likely due to a circular import)

refactor

only while loop, allow input for all vars

def generate_historical_queries(year_id, selector, max_value=None):
# transform yearid to constraint value
if not max_value:
max_value = transform_year_id(year_id, selector)
# get step and stoppage critera for constraint type
constraint_rules = get_constraint_rules(selector, year_id, is_historical=True)
stop_value = constraint_rules["stop"]
step_size = constraint_rules["step_size"]
# generate probing queries
working_value = max_value
probing_query_expressions = []
while (working_value + step_size) >= stop_value:
constraint_values = get_constraint_values(selector, working_value, step_size)
query_expression = get_query_expression(selector, **constraint_values)
probing_query_expressions.append(query_expression)
working_value = working_value - step_size
return probing_query_expressions

Missing access token parameter

I'm getting this error:

raise MissingTokenError(description="Missing access token parameter.")
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.

was hoping the answer was this simple but it was not resolved
[https://stackoverflow.com/questions/54083943/oauth-facebook-missingtokenerror-missing-token-missing-access-token-paramet]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.