Esempio n. 1
0
def attributeHTML():
    aaa.require(fail_redirect="/login")
    logger.info(request.forms.query)
    jsonString = request.forms.query
    queryResult = query(jsonString)
    # logger.debug(queryResult["selectedAttrs"])
    logger.debug(queryResult)
    # logger.debug(queryResult["selectedAttrs"])
    # return the form input and the query result
    return dict(list(queryResult.items()) + list(request.forms.items()))
Esempio n. 2
0
def attributeHTML():
    aaa.require(fail_redirect='/login')
    logger.info(request.forms.query)
    jsonString = request.forms.query
    queryResult = query(jsonString)
    #logger.debug(queryResult["selectedAttrs"])
    logger.debug(queryResult)
    #logger.debug(queryResult["selectedAttrs"])
    #return the form input and the query result
    return dict(list(queryResult.items()) + list(request.forms.items()))
Esempio n. 3
0
def search():
    aaa.require(fail_redirect="/login")
    jsonQuery = form2json(request.forms)
    """
    jsonQuery = '''{"keywords":"600Hz 1080p used Plasma HDTV",
    "attributes":["size_class", "refresh"],
    "filters":[{"attribute":"brand",
                "type":"include",
                "value":["Sony","Toshiba"]},
               {"attribute":"size_class",
                "type":"range",
                "value":[6,null]}]}'''
    """
    queryResult = query(jsonQuery)

    # return the form input and the query result
    return dict(list(queryResult.items()) + list(request.forms.items()))
Esempio n. 4
0
def search():
    aaa.require(fail_redirect='/login')
    jsonQuery = form2json(request.forms)
    """
    jsonQuery = '''{"keywords":"600Hz 1080p used Plasma HDTV",
    "attributes":["size_class", "refresh"],
    "filters":[{"attribute":"brand",
                "type":"include",
                "value":["Sony","Toshiba"]},
               {"attribute":"size_class",
                "type":"range",
                "value":[6,null]}]}'''
    """
    queryResult = query(jsonQuery)

    #return the form input and the query result
    return dict(list(queryResult.items()) + list(request.forms.items()))
Esempio n. 5
0
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 27 15:40:43 2012

@author: Max Lang
"""
from matplotlib import pyplot
from shoppersherpa.api.api import query

price = []
rating = []

b = query('{"keywords":"televisions"}')['attrs']['brand']

for option in b['options']:
    for stat in option['stats']:
        if 'price' in option['stats'] and 'ratings_avg' in option['stats']:
            price.append(option['stats']['price']['mean'])
            rating.append(option['stats']['ratings_avg']['mean'])

pyplot.scatter(rating,price)
pyplot.show()