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