# PowerSchool Python Adapter
This package is to be used with alongside a PowerSchool plugin that has enabled <oauth/> in the plugin.xml. This guide assumes you have PowerSchool API and plugin knowledge and does not cover the details of a plugin or its API.
## Installation
```bash
pip install powerschool-adapter
```
## Configuration
You need to set some variables in `.env`.
```dotenv
POWERSCHOOL_SERVER_ADDRESS=
POWERSCHOOL_CLIENT_ID=
POWERSCHOOL_CLIENT_SECRET=
```
## API
#### `PowerSchool`
The PowerSchool token is automatically retrieved upon executing an API call.
```python
from dotenv import load_dotenv
from powerschool_adapter.powerschool import PowerSchool
load_dotenv()
SERVER_ADDRESS = os.getenv("POWERSCHOOL_SERVER_ADDRESS")
CLIENT_ID = os.getenv("POWERSCHOOL_CLIENT_ID")
CLIENT_SECRET = os.getenv("POWERSCHOOL_CLIENT_SECRET")
powerschool = PowerSchool(
server_address=SERVER_ADDRESS,
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
```
#### `set_table(table)`
_Aliases: table()_
The set_table function is used to specify which database table should be queried.
```python
response = powerschool.table('students').projection(["DCID", "STUDENT_NUMBER", "LASTFIRST"]).set_method("GET").send()
student_data = json.loads(response.to_json())
print(json.dumps(student_data, indent=4))
```
#### `set_endpoint(query)`
_Aliases: to_endpoint(), to()_
```python
response = powerschool.set_endpoint("/ws/v1/student").set_id(1).get()
student_data = json.loads(response.to_json())
print(json.dumps(student_data, indent=4))
```
#### `get_endpoint()`
Return the current endpoint
#### `setId($id)`
_Aliases: for_id()_
```python
response = powerschool.to("/ws/v1/student").set_id(1).get()
student_data = json.loads(response.to_json())
print(json.dumps(student_data, indent=4))
```
### `extensions`
```python
response = powerschool.to('/ws/v1/student').set_id(52).expansions(['demographics', 'addresses', 'alerts', 'phones', 'school_enrollment', 'ethnicity_race', 'contact', 'contact_info', 'initial_enrollment']).get()
```
#### `q(expression)`
_Aliases: query_expression()_
Sets the `q` variable to the given FIQL expression.
```python
response = powerschool.set_endpoint("/ws/v1/student").q("name.last_name==Ada*").get()
student_data = json.loads(response.to_json())
print(json.dumps(student_data, indent=4))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tonylabs/python-powerschool-adapter",
"name": "powerschool-adapter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "powerschool, education, api, adapter",
"author": "TONYLABS TECH CO., LTD.",
"author_email": "\"TONYLABS TECH CO., LTD.\" <tony.wang@tonylabs.com>",
"download_url": "https://files.pythonhosted.org/packages/26/d1/f66a7cb56cd11744d5d05ae4b718c5ecd8a70835832daa63274d83dc0cfe/powerschool_adapter-1.0.1.tar.gz",
"platform": null,
"description": "# PowerSchool Python Adapter\n\nThis package is to be used with alongside a PowerSchool plugin that has enabled <oauth/> in the plugin.xml. This guide assumes you have PowerSchool API and plugin knowledge and does not cover the details of a plugin or its API.\n\n## Installation\n\n```bash\npip install powerschool-adapter\n```\n\n## Configuration\n\nYou need to set some variables in `.env`.\n\n```dotenv\nPOWERSCHOOL_SERVER_ADDRESS=\nPOWERSCHOOL_CLIENT_ID=\nPOWERSCHOOL_CLIENT_SECRET=\n```\n\n## API\n\n#### `PowerSchool`\n\nThe PowerSchool token is automatically retrieved upon executing an API call.\n\n```python\nfrom dotenv import load_dotenv\nfrom powerschool_adapter.powerschool import PowerSchool\n\nload_dotenv()\n\nSERVER_ADDRESS = os.getenv(\"POWERSCHOOL_SERVER_ADDRESS\")\nCLIENT_ID = os.getenv(\"POWERSCHOOL_CLIENT_ID\")\nCLIENT_SECRET = os.getenv(\"POWERSCHOOL_CLIENT_SECRET\")\n\npowerschool = PowerSchool(\n\tserver_address=SERVER_ADDRESS,\n\tclient_id=CLIENT_ID,\n\tclient_secret=CLIENT_SECRET\n)\n```\n\n#### `set_table(table)`\n\n_Aliases: table()_\n\nThe set_table function is used to specify which database table should be queried.\n\n```python\nresponse = powerschool.table('students').projection([\"DCID\", \"STUDENT_NUMBER\", \"LASTFIRST\"]).set_method(\"GET\").send()\nstudent_data = json.loads(response.to_json())\nprint(json.dumps(student_data, indent=4))\n```\n\n#### `set_endpoint(query)`\n\n_Aliases: to_endpoint(), to()_\n\n```python\nresponse = powerschool.set_endpoint(\"/ws/v1/student\").set_id(1).get()\nstudent_data = json.loads(response.to_json())\nprint(json.dumps(student_data, indent=4))\n```\n\n#### `get_endpoint()`\n\nReturn the current endpoint\n\n#### `setId($id)`\n\n_Aliases: for_id()_\n\n```python\nresponse = powerschool.to(\"/ws/v1/student\").set_id(1).get()\nstudent_data = json.loads(response.to_json())\nprint(json.dumps(student_data, indent=4))\n```\n\n### `extensions`\n\n```python\nresponse = powerschool.to('/ws/v1/student').set_id(52).expansions(['demographics', 'addresses', 'alerts', 'phones', 'school_enrollment', 'ethnicity_race', 'contact', 'contact_info', 'initial_enrollment']).get()\n```\n\n#### `q(expression)`\n\n_Aliases: query_expression()_\n\nSets the `q` variable to the given FIQL expression.\n\n```python\nresponse = powerschool.set_endpoint(\"/ws/v1/student\").q(\"name.last_name==Ada*\").get()\nstudent_data = json.loads(response.to_json())\nprint(json.dumps(student_data, indent=4))\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python adapter for PowerSchool API integration",
"version": "1.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/tonylabs/python-powerschool-adapter/issues",
"Homepage": "https://github.com/tonylabs/python-powerschool-adapter",
"Repository": "https://github.com/tonylabs/python-powerschool-adapter.git"
},
"split_keywords": [
"powerschool",
" education",
" api",
" adapter"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "97719a8cb28e7c713f9badb1e07094352fbc45723d959ba216ee764bc4711b06",
"md5": "0b8aca3fcb49f8d91077794a50930bbc",
"sha256": "e04d622ac8f02eaf1064632cc8b8dabedcbc55b8338ed2322d25610b144ff7fb"
},
"downloads": -1,
"filename": "powerschool_adapter-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0b8aca3fcb49f8d91077794a50930bbc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 13929,
"upload_time": "2025-02-05T05:51:38",
"upload_time_iso_8601": "2025-02-05T05:51:38.496347Z",
"url": "https://files.pythonhosted.org/packages/97/71/9a8cb28e7c713f9badb1e07094352fbc45723d959ba216ee764bc4711b06/powerschool_adapter-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "26d1f66a7cb56cd11744d5d05ae4b718c5ecd8a70835832daa63274d83dc0cfe",
"md5": "7aa982c435b4466b2a893ba4445ef486",
"sha256": "8d5a2e516f913917f44751abe8f171f5bbc7ec2e2646639083e2d5c79a51dd53"
},
"downloads": -1,
"filename": "powerschool_adapter-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "7aa982c435b4466b2a893ba4445ef486",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 11758,
"upload_time": "2025-02-05T05:51:40",
"upload_time_iso_8601": "2025-02-05T05:51:40.973266Z",
"url": "https://files.pythonhosted.org/packages/26/d1/f66a7cb56cd11744d5d05ae4b718c5ecd8a70835832daa63274d83dc0cfe/powerschool_adapter-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-05 05:51:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tonylabs",
"github_project": "python-powerschool-adapter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "powerschool-adapter"
}