コード例 #1
0
ファイル: updateFromEbay.py プロジェクト: lezzgiles/esp
def importCountFromEbay(itemId):

    cursor.execute('''SELECT manufacturer,brand,name,countOnEbay FROM Item WHERE itemId = ?''',(int(itemId),))

    for itemDetails in cursor:
        (manufacturer,brand,name,countOnEbay) = itemDetails
        (manufacturer,brand,name,countOnEbay) = itemDetails
        count = ebayFindItem(getItemName(manufacturer,brand,name))
        
        print count
        if count != countOnEbay:
            cursor.execute('UPDATE Item SET countOnEbay = ? WHERE itemId = ?',(count,itemId))

            c.commit()
コード例 #2
0
ファイル: stockList.py プロジェクト: lezzgiles/esp
def importCountFromEbay(itemId):

    cursor.execute('''SELECT manufacturer,brand,name,countOnEbay FROM Item WHERE itemId = ?''',(int(itemId),))

    for itemDetails in cursor:
        (manufacturer,brand,name,countOnEbay) = itemDetails
        print "Looking for %s on EBay... "%getItemName(manufacturer,brand,name)
        (manufacturer,brand,name,countOnEbay) = itemDetails
        count = ebayFindItem(getItemName(manufacturer,brand,name))
        
        print "Found %d listings<br />"%count
        if count != countOnEbay:
            cursor.execute('UPDATE Item SET countOnEbay = ? WHERE itemId = ?',(count,itemId))

            c.commit()
コード例 #3
0
ファイル: ebayListing.py プロジェクト: lezzgiles/esp
def loadFromEbay():

    itemList = []

    # Get first page, which also gets the total number of pages
    totalNumberOfPages = getPage(1,pageSize,itemList)

    # Already got first page, so start at page 2
    for pageNo in (range(2,totalNumberOfPages+1)):
        getPage(pageNo,pageSize,itemList)

    # Clean up the table
    cursor.execute("DELETE FROM ebayList")
    
    # Add the new data to the table    
    for (title,itemId,quantity) in itemList:
        cursor.execute("INSERT INTO ebayList (title,itemId,quantity) VALUES (?,?,?)",(title,itemId,quantity))

    c.commit()        
コード例 #4
0
ファイル: ebaylisting.py プロジェクト: lezzgiles/esp
def loadFromEbay():
    # specify the connection to the eBay Sandbox environment
    connection = httplib.HTTPSConnection(serverUrl)

    itemList = []

    # Get first page, which also gets the total number of pages
    totalNumberOfPages = getPage(connection,1,pageSize,itemList)

    # Already got first page, so start at page 2
    for pageNo in (range(2,totalNumberOfPages+1)):
        getPage(connection,pageNo,pageSize,itemList)

    # Clean up the table
    cursor.execute("DELETE FROM ebayList")
    
    # Add the new data to the table    
    for (title,itemId,quantity) in itemList:
        cursor.execute("INSERT INTO ebayList (title,itemId,quantity) VALUES (?,?,?)",(title,itemId,quantity))

    c.commit()        
コード例 #5
0
ファイル: binList.py プロジェクト: lezzgiles/esp
        cursor.execute('SELECT SUM(quantity) FROM binItems WHERE binId = ? and itemId = ? GROUP BY binId',(delBin,delItem))
        (foundQty,) = cursor.fetchone()

        if foundQty < totalToMove:
           raise ValueError, "<p class=error>Didn't find enough items to move</p>"

        cursor.execute('DELETE FROM binItems WHERE binId = ? and itemId = ?',(delBin,delItem))

        for (binId,binQty) in moveDetails:
            cursor.execute('INSERT INTO binItems (binId,itemId,quantity) VALUES (?,?,?)',(binId,delItem,binQty))

        if foundQty > totalToMove:
            cursor.execute('INSERT INTO binItems (binId,itemId,quantity) VALUES (?,?,?)',(delBin,delItem,foundQty-totalToMove))
            
        cursor.execute('''INSERT INTO history (historyDate,body) VALUES (DATETIME('now'),?)''',(history,))
        c.commit()
        # Redirect to same page, so page reload doesn't re-add move
        printRedirect('Move completed','binList.py',0)
        sys.exit()

    except Exception,e:
        c.rollback()
        errorString = "<p class=error>Problem with database update:</p><pre>%s</pre>"%str(sys.exc_info())
    
printHeader2('Bin/stock list',errorString)

#########################################    
cursor.execute('''
SELECT
    binId,itemId,Bin.name,Item.manufacturer,Item.brand,Item.name,SUM(quantity)
FROM