コード例 #1
0
class Sniff(threading.Thread):
    def __init__(self):
        super(Sniff, self).__init__()
        self.crawler = Bloodhound()
        self.crawler.feed('http://www.verkkokauppa.com/')

    def run(self):
        self.crawler.sniff()
コード例 #2
0
ファイル: sniff.py プロジェクト: pratheeraja/bloodhound
class Sniff(threading.Thread):

    def __init__(self):
        super(Sniff, self).__init__()
        self.crawler = Bloodhound()
        self.crawler.feed('http://www.verkkokauppa.com/')

    def run(self):
        self.crawler.sniff()
コード例 #3
0
ファイル: views.py プロジェクト: ThiaguinhoLS/CodeStudy
def product_refresh(request, code):
    try:
        product = Product.objects.get(code=code)
        crawler = Bloodhound()
        crawler.howl(product)
        return redirect(r('product', args=(code,)))
    except Product.DoesNotExist:
        messages.error(request, u'Product with code {0} was not found.'.format(code))
        return redirect(r('home'))
コード例 #4
0
ファイル: howl.py プロジェクト: ThiaguinhoLS/CodeStudy
class Howl(threading.Thread):
    def __init__(self):
        super(Howl, self).__init__()
        self.crawler = Bloodhound()

    def run(self):
        while True:
            products = Product.objects.all().order_by('visited_at')
            for product in products:
                self.crawler.howl(product)
コード例 #5
0
ファイル: howl.py プロジェクト: pratheeraja/bloodhound
class Howl(threading.Thread):

    def __init__(self):
        super(Howl, self).__init__()
        self.crawler = Bloodhound()

    def run(self):
        while True:
            products = Product.objects.all().order_by('visited_at')
            for product in products:
                self.crawler.howl(product)
コード例 #6
0
ファイル: views.py プロジェクト: ThiaguinhoLS/CodeStudy
def product_details(request, code):
    try:
        product = Product.objects.get(code=code)
    except Product.DoesNotExist:
        crawler = Bloodhound()
        product = Product(code=code)
        product = crawler.howl(product)

    if product.status == Product.OK:
        price_history_chart = product.price_history.all().order_by('created_at')
        return render(request, 'core/product_details.html', { 
                'product': product,
                'price_history_chart': price_history_chart
            })
    else:
        messages.error(request, u'Product with code {0} was not found.'.format(code))
        return redirect(r('home'))
コード例 #7
0
ファイル: views.py プロジェクト: pratheeraja/bloodhound
def product(request):
    product_code = request.GET.get('code')
    try:
        product = Product.objects.get(code=product_code)
    except Product.DoesNotExist:
        product = Product(code=product_code)
        crawler = Bloodhound()
        product = crawler.howl(product)
    if product.status == Product.OK:
        lowest_price = PriceHistory.objects.filter(product=product).order_by('price')[0]
        highest_price = PriceHistory.objects.filter(product=product).order_by('-price')[0]
        return render(request, 'api/product.html', { 
                'product': product,
                'lowest_price': lowest_price,
                'highest_price': highest_price
            })
    else:
        return render(request, 'api/product_not_found.html')
        
コード例 #8
0
def product(request):
    product_code = request.GET.get('code')
    try:
        product = Product.objects.get(code=product_code)
    except Product.DoesNotExist:
        product = Product(code=product_code)
        crawler = Bloodhound()
        product = crawler.howl(product)
    if product.status == Product.OK:
        lowest_price = PriceHistory.objects.filter(
            product=product).order_by('price')[0]
        highest_price = PriceHistory.objects.filter(
            product=product).order_by('-price')[0]
        return render(
            request, 'api/product.html', {
                'product': product,
                'lowest_price': lowest_price,
                'highest_price': highest_price
            })
    else:
        return render(request, 'api/product_not_found.html')
コード例 #9
0
ファイル: sniff.py プロジェクト: pratheeraja/bloodhound
 def __init__(self):
     super(Sniff, self).__init__()
     self.crawler = Bloodhound()
     self.crawler.feed('http://www.verkkokauppa.com/')
コード例 #10
0
ファイル: howl.py プロジェクト: pratheeraja/bloodhound
 def __init__(self):
     super(Howl, self).__init__()
     self.crawler = Bloodhound()
コード例 #11
0
 def __init__(self):
     super(Sniff, self).__init__()
     self.crawler = Bloodhound()
     self.crawler.feed('http://www.verkkokauppa.com/')
コード例 #12
0
ファイル: howl.py プロジェクト: ThiaguinhoLS/CodeStudy
 def __init__(self):
     super(Howl, self).__init__()
     self.crawler = Bloodhound()