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

Method unfavorite

scratchattach/site/project.py:543–557  ·  view source on GitHub ↗

Removes the favorite from this project. You can only use this function if this object was created using :meth:`scratchattach.session.Session.connect_project`

(self)

Source from the content-addressed store, hash-verified

541 raise exceptions.APIError(str(r))
542
543 def unfavorite(self):
544 """
545 Removes the favorite from this project. You can only use this function if this object was created using :meth:`scratchattach.session.Session.connect_project`
546 """
547 session = self._assert_auth()
548 r = requests.delete(
549 f"https://api.scratch.mit.edu/proxy/projects/{self.id}/favorites/user/{session.username}",
550 headers=self._headers,
551 cookies=self._cookies,
552 ).json()
553 if "userFavorite" in r:
554 if r["userFavorite"] is True:
555 self.unfavorite()
556 else:
557 raise exceptions.APIError(str(r))
558
559 def post_view(self):
560 """

Callers

nothing calls this directly

Calls 3

jsonMethod · 0.80
_assert_authMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected