Ejemplo n.º 1
0
 def json_to_trend(self, response):
     if isinstance(response, list):
         trends = []
         for tr in response:
             trend = self.json_to_trend(tr)
             trends.append(trend)
         return trends
     else:
         trend = Trend()
         trend.name = response['name']
         trend.promoted = False
         if response['promoted_content']:
             trend.promoted = True
         return trend
Ejemplo n.º 2
0
 def json_to_trend(self, response):
     if isinstance(response, list):
         trends = []
         for tr in response:
             trend = self.json_to_trend(tr)
             trends.append(trend)
         return trends
     else:
         trend = Trend()
         trend.name = response['name']
         trend.promoted = False
         if response['promoted_content']:
             trend.promoted = True
         return trend