Returns: boolean : True if the user exists, False if the user is deleted, None if an error occured
(self)
| 289 | return self._classroom[1] |
| 290 | |
| 291 | def does_exist(self) -> Optional[bool]: |
| 292 | """ |
| 293 | Returns: |
| 294 | boolean : True if the user exists, False if the user is deleted, None if an error occured |
| 295 | """ |
| 296 | with requests.no_error_handling(): |
| 297 | status_code = requests.get(f"https://scratch.mit.edu/users/{self.username}/").status_code |
| 298 | if status_code == 200: |
| 299 | return True |
| 300 | elif status_code == 404: |
| 301 | return False |
| 302 | |
| 303 | return None |
| 304 | |
| 305 | # Will maybe be deprecated later, but for now still has its own purpose. |
| 306 | # @deprecated("This function is partially deprecated. Use user.rank() instead.") |