def do_crawler(self, para): print "do_crawler" #create crawler engin crawler_engine = Engine() #start engine crawler_engine.start() #stop engin crawler_engine.stop()
def do_crawler(self,para): print "do_crawler" #create crawler engin crawler_engine = Engine() #start engine crawler_engine.start( ) #stop engin crawler_engine.stop()
def main(): try: #create crawler engin crawler_engine = Engine() #start engine crawler_engine.start( ) #hold the main thread here, wait for any input to finish raw_input("") #stop engin crawler_engine.stop() except (Exception) as e: #Log().debug(e) sys.exit(0)
class Crawler(): def __init__(self): os.chdir('./global_vars') from core.engine import Engine os.chdir('..') self.engine = Engine() def _start_engine(self): self.engine.start() def _stop_engine(self): self.engine.stop() def crawl(self): # entrance method self._start_engine() def stop(self): self._stop_engine()
def main(): manager, port, downloaders = parseCommandLineArgs() engine = Engine(downloaders, manager, port) engine.start() raw_input("press any key to stop....\n") engine.stop()