if baseName != None:
        print "base name:  " + baseName
    if len(location) > 0:
        if baseName != None:
            localData = productSearch.localDataParser().getLocalProductData(baseName, location)
            if localData != None:
                avgPrice = localData[0]
                validLocal = True
                response += "Local: " + massageName(localData[1], 25) + " $" + str(massagePrice(localData[3])) + " at " + massageName(localData[2], 15) + "\n"
            else:
                response += "Local: No Results\n"
        else:
            response += "Local: No Results\n"
    
    # online    
    googleData = productSearch.getGoogleProductData(baseName, upc, numGoogleResults)
    item = None
    if googleData != None:
        validOnline = True
        item = googleData[0]
        avgPrice += googleData[1]
        if validLocal:
            avgPrice /= 2

        response += "Web: " + massageName(item[0], 25) + " $" + str(massagePrice(item[2])) + " at " + massageName(item[1], 15) + "\n"
    else:
        response += "Web: No Results\n"
    
    # send sms
    if validLocal or validOnline:
        response += "Avg: $" + str(massagePrice(avgPrice)) + "\n"
Beispiel #2
0
                response += (
                    "Local: "
                    + massageName(localData[1], 25)
                    + " $"
                    + str(massagePrice(localData[3]))
                    + " at "
                    + massageName(localData[2], 15)
                    + "\n"
                )
            else:
                response += "Local: No Results\n"
        else:
            response += "Local: No Results\n"

    # online
    googleData = productSearch.getGoogleProductData(upc, numGoogleResults)
    if googleData != None:
        validOnline = True
        item = googleData[0]
        avgPrice += googleData[1]
        if validLocal:
            avgPrice /= 2
        response += (
            "Web: "
            + massageName(item[0], 25)
            + " $"
            + str(massagePrice(item[2]))
            + " at "
            + massageName(item[1], 15)
            + "\n"
        )
Beispiel #3
0
            localData = productSearch.localDataParser().getLocalProductData(
                baseName, location)
            if localData != None:
                avgPrice = localData[0]
                validLocal = True
                response += "Local: " + massageName(
                    localData[1], 25) + " $" + str(massagePrice(
                        localData[3])) + " at " + massageName(
                            localData[2], 15) + "\n"
            else:
                response += "Local: No Results\n"
        else:
            response += "Local: No Results\n"

    # online
    googleData = productSearch.getGoogleProductData(baseName, upc,
                                                    numGoogleResults)
    item = None
    if googleData != None:
        validOnline = True
        item = googleData[0]
        avgPrice += googleData[1]
        if validLocal:
            avgPrice /= 2

        response += "Web: " + massageName(item[0], 25) + " $" + str(
            massagePrice(item[2])) + " at " + massageName(item[1], 15) + "\n"
    else:
        response += "Web: No Results\n"

    # send sms
    if validLocal or validOnline: