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

Method love

scratchattach/site/project.py:495–509  ·  view source on GitHub ↗

Posts a love on the 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

493 return _comment
494
495 def love(self):
496 """
497 Posts a love on the project. You can only use this function if this object was created using :meth:`scratchattach.session.Session.connect_project`
498 """
499 session = self._assert_auth()
500 r = requests.post(
501 f"https://api.scratch.mit.edu/proxy/projects/{self.id}/loves/user/{session.username}",
502 headers=self._headers,
503 cookies=self._cookies,
504 ).json()
505 if "userLove" in r:
506 if r["userLove"] is False:
507 self.love()
508 else:
509 raise exceptions.APIError(str(r))
510
511 def unlove(self):
512 """

Callers

nothing calls this directly

Calls 3

jsonMethod · 0.80
postMethod · 0.80
_assert_authMethod · 0.45

Tested by

no test coverage detected