Unofficial api wrapper for practically which is an OS used by many schools to publish assignments, report cards and lectures.
from practically import Practically
p = Practically()
p.create_session("your-assigned-username", "your-password")
user = p.get_user()
print(user.first_name, user.last_name)
prac = Practically(
base_url = "https://teach.practically.com",
session_file = "session.pickle"
)
prac.create_session("username", "password")
or, if you are using dotenv you can
prac.create_session_from_env("username_key", "password_key")
If a valid session_id
is not found in the session_file
it will create a new one. You can check if the current session is invalid using.
prac.is_session_expired_or_invalid()
user = prac.get_user()
user.email
user.first_name
user.last_name
user.display_name
user.phone_number
calendar = prac.get_calendar(datetime.date(2023, 12, 12))
Returns a collection of CalendarEntry
calendar[0].teacher_name
calendar[0].start_time
calendar[0].title
A user can be enrolled in one or more classrooms.
c = prac.get_classrooms()
print(len(c)) # __getitem__ and __len__ can be used
A single clasroom looks like so
c.classroom_name
c.classroom_owner_name
c.classroom_id
This returns all the assignments for the user
assignments = prac.get_assignments("123456") // you can get this through classrooms
print(len(assignments)) # __getitem__ and __len__ can be used
A single clasroom looks like so
assignment.title
: stringassignment.start_time
: returns a datetime objectassignment.end_time
: returns a datetime objectassignment.pdf_url
: return the link to the pdf CDN
from practically.practically import Practically
from datetime import datetime
from dotenv import load_dotenv
load_dotenv()
p = Practically()
p.create_session_from_env("USERNAME", "PASSWORD")
classroom_id = p.get_classrooms()[0].id
assignments = [
a.title
for a in p.get_assignments(classroom_id)
if a.end_time > datetime.today()
]