Пример #1
0
    def post(self, request):
        """ Callback to notify about a feed update """

        feed_url = request.GET.get('url')

        if not feed_url:
            logger.info('received notification without url')
            return HttpResponse(status=400)

        logger.info('received notification for %s' % feed_url)

        try:
            subscription = HubSubscription.objects.get(topic_url=feed_url)

        except HubSubscription.DoesNotExist:
            logger.warning('no subscription for this URL')
            return HttpResponse(status=400)

        if subscription.mode != 'subscribe':
            logger.warning('invalid subscription mode: %s' % subscription.mode)
            return HttpResponse(status=400)

        if not subscription.verified:
            logger.warning('the subscription has not yet been verified')
            return HttpResponse(status=400)

        subscription_updated.send(sender=feed_url)

        return HttpResponse(status=200)
Пример #2
0
    def post(self, request):
        """ Callback to notify about a feed update """

        feed_url = request.GET.get('url')

        if not feed_url:
            logger.info('received notification without url')
            return HttpResponse(status=400)

        logger.info('received notification for %s' % feed_url)

        subscription = subscription_for_topic(feed_url)

        if subscription is None:
            logger.warn('no subscription for this URL')
            return HttpResponse(status=400)

        if subscription.mode != 'subscribe':
            logger.warn('invalid subscription mode: %s' % subscription.mode)
            return HttpResponse(status=400)

        if not subscription.verified:
            logger.warn('the subscription has not yet been verified')
            return HttpResponse(status=400)

        subscription_updated.send(sender=feed_url)

        return HttpResponse(status=200)