示例#1
0
文件: aecrawler.py 项目: zhangkn/hail
def qhandler_search_category(params):
    global _HTTPOPENER
    categoryId = params['id']
    parentId = params['parent']
    depthFrom = params['depth']
    depthTo = depthFrom
    retries = 3

    EAPI.searchCategory(categoryFetched, retries, _HTTPOPENER, depthFrom,
                        depthTo, categoryId, parentId)
示例#2
0
文件: aecrawler.py 项目: zhangkn/hail
def startCrawler(categoryId):
    global _HTTPOPENER
    _HTTPOPENER = getHTTPOpener()
    depthFrom = 0
    depthTo = depthFrom
    retries = 3

    openMQChannel()
    EAPI.searchCategory(categoryFetched, retries, _HTTPOPENER, depthFrom,
                        depthTo, categoryId)
    closeMQ()
示例#3
0
def qb_search_category(ch, method, properties, body):
    global _HTTPOPENER
    params = json.loads(body)
    categoryId = params['id']
    parentId = params['parent']
    depthFrom = params['depth']
    depthTo = depthFrom
    retries = 3

    EAPI.searchCategory(categoryFetched, retries, _HTTPOPENER, depthFrom,
                        depthTo, categoryId, parentId)
    time.sleep(0.1)
    ch.basic_ack(delivery_tag=method.delivery_tag)
示例#4
0
 def test_searchCategory(self):
     cid = 200000662
     r = EAPI.searchCategory(None, 0, self.opener, 0, 0, cid)
     self.assertEqual(r['name'], 'Jackets & Coats')