コード例 #1
0
ファイル: price.py プロジェクト: guangfeng/spy-sites
def custmor(job):
    item_id, store_id = job
    _url = "http://jprice.360buyimg.com/price/gp%d-1-1-3.png" % int(store_id)

    _f = urllib.urlopen(_url, proxies={"http": "http://127.0.0.1:8091"})
    try:

        _im = Image.open(proxy_store(store_id))
        _text = pytesser.image_to_string(_im)
        _res = filter(lambda ch: ch in "0123456789.", _text[2:])
        print store_id, _res
        _sql = "update item_from_360 set store_price = %f where item_id = %d" % (float(_res), int(item_id))
        DB.update(_sql)
    except:
        pass
コード例 #2
0
ファイル: price.py プロジェクト: guangfeng/spy-sites
def worker():
    while True:
        item = q.get()
        try:
            item_id, store_id = item
            _url = "http://jprice.360buyimg.com/price/gp%d-1-1-3.png" % int(store_id)
            download_file(_url, "_", "http://127.0.0.1:8091")
            _im = Image.open(proxy_store(store_id))
            _text = pytesser.image_to_string(_im)
            _res = filter(lambda ch: ch in "0123456789.", _text[2:])
            print store_id, _res
            _sql = "update item_from_360 set store_price = %f where item_id = %d" % (float(_res), int(item_id))
            DB.update(_sql)
        finally:
            q.task_done()
コード例 #3
0
def custmor(job):
    item_id, store_id = job
    _url = "http://jprice.360buyimg.com/price/gp%d-1-1-3.png" % int(store_id)

    _f = urllib.urlopen(_url, proxies={'http': 'http://127.0.0.1:8091'})
    try:

        _im = Image.open(proxy_store(store_id))
        _text = pytesser.image_to_string(_im)
        _res = filter(lambda ch: ch in '0123456789.', _text[2:])
        print store_id, _res
        _sql = "update item_from_360 set store_price = %f where item_id = %d" % (
            float(_res), int(item_id))
        DB.update(_sql)
    except:
        pass
コード例 #4
0
def worker():
    while True:
        item = q.get()
        try:
            item_id, store_id = item
            _url = "http://jprice.360buyimg.com/price/gp%d-1-1-3.png" % int(
                store_id)
            download_file(_url, '_', 'http://127.0.0.1:8091')
            _im = Image.open(proxy_store(store_id))
            _text = pytesser.image_to_string(_im)
            _res = filter(lambda ch: ch in '0123456789.', _text[2:])
            print store_id, _res
            _sql = "update item_from_360 set store_price = %f where item_id = %d" % (
                float(_res), int(item_id))
            DB.update(_sql)
        finally:
            q.task_done()