コード例 #1
0
ファイル: twitter.py プロジェクト: arepadev/libturpial
 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
コード例 #2
0
ファイル: twitter.py プロジェクト: pnael/Python
 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(response['name'])
         trend.query = response['query']
         trend.url = response['url']
         if response['promoted_content']:
             trend.is_promoted = True
         return trend
コード例 #3
0
ファイル: twitter.py プロジェクト: satanas/libturpial
 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(response['name'])
         trend.query = response['query']
         trend.url = response['url']
         if response['promoted_content']:
             trend.is_promoted = True
         return trend
コード例 #4
0
ファイル: twitter.py プロジェクト: neilwightman/libturpial
 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
コード例 #5
0
ファイル: twitter.py プロジェクト: Bouska/libturpial
 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(response["name"])
         trend.query = response["query"]
         trend.url = response["url"]
         if response["promoted_content"]:
             trend.is_promoted = True
         return trend
コード例 #6
0
    def test_get_trending_topics(self, monkeypatch):
        trend = Trend('Foo')
        monkeypatch.setattr(self.account, "trends", lambda x: [trend])

        response = self.core.get_trending_topics(self.acc_id, "here")
        assert isinstance(response, list)
        assert response[0] == trend