Beispiel #1
0
 def post_comment(self, comment, yak, btp=False, basecamp=False):
     """Post a comment on a yak (optionally at basecamp and optionally with
     parameter bypassedThreatPopup as btp). Return the comment (or None if
     not posted)"""
     self._validate_basecamp(basecamp)
     message_id = self._convert_to_message_id(yak)
     raw = yikyakapi.post_comment(self, comment, message_id, btp, basecamp)
     # Comments only post properly if get_comments is called directly after
     yikyakapi.get_comments(self, message_id, basecamp=basecamp)
     self.update()
     # If success is reported
     if bool(int(raw.text)):
         try:
             return self.get_comments(message_id, basecamp=basecamp)[-1]
         except IndexError:
             return None
     else:
         return None
Beispiel #2
0
 def get_comments(self, yak, basecamp=False):
     """Return a list of comments on a Yak (optionally at basecamp)"""
     self._validate_basecamp(basecamp)
     message_id = self._convert_to_message_id(yak)
     raw = yikyakapi.get_comments(self, message_id, basecamp)
     return self._get_comment_list(raw)