Returns: scratchattach.comments.Comment: A Comment object representing the requested comment.
(self, comment_id)
| 472 | return commons.parse_object_list(response, comment.Comment, self._session) |
| 473 | |
| 474 | def comment_by_id(self, comment_id): |
| 475 | """ |
| 476 | Returns: |
| 477 | scratchattach.comments.Comment: A Comment object representing the requested comment. |
| 478 | """ |
| 479 | # https://api.scratch.mit.edu/users/TimMcCool/projects/404369790/comments/439984518 |
| 480 | data = requests.get( |
| 481 | f"https://api.scratch.mit.edu/users/{self.author_name}/projects/{self.id}/comments/{comment_id}", |
| 482 | headers=self._headers, |
| 483 | cookies=self._cookies, |
| 484 | ).json() |
| 485 | |
| 486 | if data is None or data.get("code") == "NotFound": |
| 487 | raise exceptions.CommentNotFound(f"Cannot find comment #{comment_id} on -P {self.id} by -U {self.author_name}") |
| 488 | |
| 489 | _comment = comment.Comment( |
| 490 | id=data["id"], _session=self._session, source=comment.CommentSource.PROJECT, source_id=self.id |
| 491 | ) |
| 492 | _comment._update_from_dict(data) |
| 493 | return _comment |
| 494 | |
| 495 | def love(self): |
| 496 | """ |
no test coverage detected