Пример #1
0
 def get_hashtags(request, topic_id=1, date_string='yesterday'):
     try:
         results = DSPConnectorV13.get_hashtags(topic_id,
                                                date_string)['hashtags']
     except DSPConnectorException:
         results = {}
     return JsonResponse({'status': 'ok', 'result': results}, status=200)
Пример #2
0
 def get_influencers(request, topic_id=1, location=None):
     if not location:
         place = json.loads(request.user.profile.place)
         location = place['country_short']
     try:
         results = DSPConnectorV13.get_influencers(topic_id, location)
     except DSPConnectorException:
         results = {}
     return JsonResponse({'status': 'ok', 'result': results}, status=200)
Пример #3
0
    def get_events(request, topic_id, location='', cursor=0):
        try:
            events = DSPConnectorV13.get_events(topic_id, location, cursor)
        except DSPConnectorException:
            events = {}
        'previous_cursor' not in events and events.update(
            {'previous_cursor': 0})

        return JsonResponse({'status': 'ok', 'result': events}, status=200)
Пример #4
0
    def get_news(request, topic_id=1, date_string='yesterday', cursor=0):

        item_per_page = 20
        news = []
        next_cursor = 0
        resp = {}

        try:
            results = DSPConnectorV13.get_news(topic_id, date_string, cursor)
            # news = results['news']
            # next_cursor = results['next_cursor']/item_per_page
            # resp = {'news': news, 'next_cursor': next_cursor, 'max_page': None}
        except DSPConnectorException:
            pass
        return JsonResponse({
            'status': 'ok',
            'result': results,
        }, status=200)
Пример #5
0
 def topic_ids(self):
     topics_list = DSPConnectorV13.get_topics()['topics']
     return [x['topic_id'] for x in topics_list]