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)
def startCrawler(categoryId): global _HTTPOPENER _HTTPOPENER = getHTTPOpener() depthFrom = 0 depthTo = depthFrom retries = 3 openMQChannel() EAPI.searchCategory(categoryFetched, retries, _HTTPOPENER, depthFrom, depthTo, categoryId) closeMQ()
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)
def test_searchCategory(self): cid = 200000662 r = EAPI.searchCategory(None, 0, self.opener, 0, 0, cid) self.assertEqual(r['name'], 'Jackets & Coats')