def get_metadata(self):
"""Returns a dictionary with information about this ``ProgramCommentReply``."""
# there's no way that I've found to get comment reply metadata directly,
# so we iterate though the comment thread until you find this comment
for comment_data in self.get_parent().get_reply_data():
if comment_data["key"] == self.id:
return comment_data
raise _CommentDoesntExistError(self)
# I'm keeping this todo until I can fully address it, although I did
# add an error
# todo: raise some error instead of returning None. What error? IDK.
# I'm almost tempted to pretend it's an HTTPError, but I'll need to do
# some research into why we would get here (We can get here btw.
# That's how I found this). Would self.get_parent().get_reply_data()
# raise an HTTPError if self.comment_key was nonsense? If that's the
# case, we will only (probably) be here if comment_key was a
# ProgramComment key instead of a ProgramCommentReply key, so we would
# probably want to have an error that's more specific (like TypeError
# maybe?). Man, there are so many edge cases with this stuff that I
# really should look into now that I think about it... We are also
# probably going to need to keep a lot of this comment to explain why
# we raise the error we do.
评论列表
文章目录