MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / does_exist

Method does_exist

scratchattach/site/user.py:291–303  ·  view source on GitHub ↗

Returns: boolean : True if the user exists, False if the user is deleted, None if an error occured

(self)

Source from the content-addressed store, hash-verified

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.")

Callers 2

handle_handshakeMethod · 0.80
test_userFunction · 0.80

Calls 2

no_error_handlingMethod · 0.45
getMethod · 0.45

Tested by 1

test_userFunction · 0.64