Get a list of private activity, only available to the class owner. Returns: list The private activity of users in the class
(self, student: str = "all", mode: str = "Last created", page: Optional[int] = None)
| 355 | return activities |
| 356 | |
| 357 | def activity(self, student: str = "all", mode: str = "Last created", page: Optional[int] = None) -> list[activity.Activity]: |
| 358 | """ |
| 359 | Get a list of private activity, only available to the class owner. |
| 360 | Returns: |
| 361 | list<activity.Activity> The private activity of users in the class |
| 362 | """ |
| 363 | |
| 364 | self._check_session() |
| 365 | |
| 366 | ascsort, descsort = commons.get_class_sort_mode(mode) |
| 367 | |
| 368 | with requests.no_error_handling(): |
| 369 | try: |
| 370 | data = requests.get(f"https://scratch.mit.edu/site-api/classrooms/activity/{self.id}/{student}/", |
| 371 | params={"page": page, "ascsort": ascsort, "descsort": descsort}, |
| 372 | headers=self._headers, cookies=self._cookies).json() |
| 373 | except json.JSONDecodeError: |
| 374 | return [] |
| 375 | |
| 376 | _activity: list[activity.Activity] = [] |
| 377 | for activity_json in data: |
| 378 | _activity.append(activity.Activity(_session=self._session)) |
| 379 | _activity[-1]._update_from_json(activity_json) # NOT the same as _update_from_dict |
| 380 | |
| 381 | return _activity |
| 382 | |
| 383 | |
| 384 | def get_classroom(class_id: str) -> Classroom: |
nothing calls this directly
no test coverage detected