예제 #1
0
 def fill_data_from_json(self, json_data):
     self.author = json_data.get('actor').get('displayName')
     self.title = json_data.get('title')
     self.published = string_to_datetime(json_data.get('published'))
     self.updated = self.updated_if_needed(json_data.get('updated'))
     self.url = json_data.get('url')
     self.content = Markup(json_data.get('object').get('content'))
     self.replies = json_data.get('object').get('replies').get('totalItems')
예제 #2
0
 def updated_if_needed(self, updated_date):
     updated_date = string_to_datetime(updated_date)
     if updated_date > self.published + datetime.timedelta(seconds=5):
         return updated_date