-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_this_after_dummy_enroll.py
32 lines (27 loc) · 1.05 KB
/
run_this_after_dummy_enroll.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import json
import colorama
from faker import Faker
from colorama import Fore
from dotenv import load_dotenv
from powerschool_adapter.powerschool import PowerSchool
load_dotenv()
fake = Faker()
colorama.init(autoreset=True)
if (os.getenv('POWERSCHOOL_SERVER_ADDRESS') is None or
os.getenv('POWERSCHOOL_CLIENT_ID') is None or
os.getenv('POWERSCHOOL_CLIENT_SECRET') is None):
print("PowerSchool environment variables were not set.")
exit()
# Load sensitive data from environment variables
POWERSCHOOL_SERVER_ADDRESS = os.getenv("POWERSCHOOL_SERVER_ADDRESS")
POWERSCHOOL_CLIENT_ID = os.getenv("POWERSCHOOL_CLIENT_ID")
POWERSCHOOL_CLIENT_SECRET = os.getenv("POWERSCHOOL_CLIENT_SECRET")
powerschool = PowerSchool(
server_address=POWERSCHOOL_SERVER_ADDRESS,
client_id=POWERSCHOOL_CLIENT_ID,
client_secret=POWERSCHOOL_CLIENT_SECRET
)
response = powerschool.table('students').projection(["DCID", "STUDENT_NUMBER", "FIRST_NAME", "LAST_NAME"]).set_method("GET").send()
students = json.loads(response.to_json())
print(Fore.GREEN + json.dumps(students, indent=4))