示例#1
0
    def __init__(self, user, pwd):
        self.BUY_SYSTEM_GOODS_PRICE_MAX = 0
        self.BUY_SYSTEM_GOODS_PRICE_MIN = 999999999
        self.STALL_GOODS_QUANTITY_MAX = 0
        self.BUY_USER_GOODS_PRICE_MAX = 0
        self.BUY_USER_GOODS_PRICE_MIN = 999999999
        self.STORE_GOODS_QUANTITY_MAX = 0
        self.MONEY_KEEP = 0

        self.URL_KAIXIN_HOME = "http://kaixin001.com/"
        self.URL_KAIXIN_LOGIN = '******'

        self.downloader = DownloadManager()
        self.kaixindb =  WebpageDB(user+'.db')
        self.load_settings(user+'.cfg') 
        self.MY_STALL_ID = None
        self.MY_TOTAL_MONEY = None
示例#2
0
import sys
from crawler.database import WebpageDB
import json
kaixindb = WebpageDB('stall.db')
kaixindb2 = WebpageDB('stall2.db')

prices = {}
try:
    DBCursor = kaixindb2.get_cursor()
    flag = ""
    cnt = 0
    while flag != None:
        cnt += 1
        flag = DBCursor.next()
        if flag != None:
            key = str(flag[0])
            val = json.loads(flag[1])
            prices[key] = val
finally:
    DBCursor.close()
    kaixindb2.close()

try:
    DBCursor = kaixindb.get_cursor()
    flag = ""
    cnt = 0
    while flag != None:
        cnt += 1
        flag = DBCursor.next()
        if flag != None:
            key = str(flag[0])
示例#3
0
    
    pass
if __name__== "__main__":
    user = sys.argv[1]
    pwd = sys.argv[2]
    ##
    ret = login(user, pwd)
    if ret == True:
        print "login into system"
    ##
    sysbuy_low, sysbuy_hig, sysbuy_qua, money_remain = load_settings(user+'.cfg') 
    buy_low  = sysbuy_low
    buy_high =  sysbuy_hig


    kaixindb =  WebpageDB(user+'.db')
    ############################################33
    selltimer = 1
    sellcnt = 0
    init = True
    try:
        while 1:
            #####SELL#########
            sellcnt += 1
            if sellcnt >= selltimer:
                print "================================"
                print "try to sell....", time.ctime()
                gid, price, num = get_buy_info()
                if price > 0 :
                    sell(gid, num)
                    print 'SELL',gid,num, time.ctime()
示例#4
0
import sys
from crawler.database import WebpageDB
kaixindb =  WebpageDB('stall.db')


rec_num = int(sys.argv[1])


try:
    DBCursor = kaixindb.get_cursor()
    print "a"
    flag = ""
    cnt = 0
    while flag !=None:
        cnt += 1
        flag =  DBCursor.next()
        if flag != None: #and cnt == rec_num:
            print "######### KEY ###########",flag[0]
            print "@@@@@@@@@ VALUE @@@@@@@@@",flag[1]
            #break
finally:
    DBCursor.close()
    kaixindb.close()