def parse_post(self, post):
"""Read post JSON and return values in easily-readable dictionary."""
# Old json - without name field
if len(post) == 3:
parsed_post = {
"name": "Anonymous",
"stamp": self.convert_time(post[0]),
"id": str(post[1]),
"text": ur.Text(post[2])
}
else:
parsed_post = {
"name": post[0],
"stamp": self.convert_time(post[1]),
"id": str(post[2]),
"text": ur.Text(post[3])
}
return parsed_post
评论列表
文章目录