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)
| 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 | """ |
nothing calls this directly
no test coverage detected