def execute(config_file): global config config = _get_config(config_file) log.startLogging(sys.stderr) application = get_application(config) app.startApplication(application, False) reactor.run() #@UndefinedVariable
def execute(): try: config = _get_config() except NotConfigured: config = None log.startLogging(sys.stderr) application = get_application(config) app.startApplication(application, False) reactor.run()
def setUp(self): path = os.path.abspath(self.mktemp()) j = os.path.join eggs_dir = j(path, 'eggs') os.makedirs(eggs_dir) dbs_dir = j(path, 'dbs') os.makedirs(dbs_dir) logs_dir = j(path, 'logs') os.makedirs(logs_dir) os.chdir(path) with open('scrapyd.conf', 'w') as f: f.write("[scrapyd]\n") f.write("eggs_dir = %s\n" % eggs_dir) f.write("dbs_dir = %s\n" % dbs_dir) f.write("logs_dir = %s\n" % logs_dir) self.app = get_application()
def project_environment(project): app = get_application() eggstorage = app.getComponent(IEggStorage) version, eggfile = eggstorage.get(project) if eggfile: prefix = '%s-%s-' % (project, version) fd, eggpath = tempfile.mkstemp(prefix=prefix, suffix='.egg') lf = os.fdopen(fd, 'wb') shutil.copyfileobj(eggfile, lf) lf.close() activate_egg(eggpath) else: eggpath = None try: assert 'scrapy.conf' not in sys.modules, "Scrapy settings already loaded" yield finally: if eggpath: os.remove(eggpath)
def test_get_spider_list(self): path = os.path.abspath(self.mktemp()) j = os.path.join eggs_dir = j(path, 'eggs') os.makedirs(eggs_dir) dbs_dir = j(path, 'dbs') os.makedirs(dbs_dir) logs_dir = j(path, 'logs') os.makedirs(logs_dir) os.chdir(path) with open('scrapyd.conf', 'w') as f: f.write("[scrapyd]\n") f.write("eggs_dir = %s\n" % eggs_dir) f.write("dbs_dir = %s\n" % dbs_dir) f.write("logs_dir = %s\n" % logs_dir) app = get_application() eggstorage = app.getComponent(IEggStorage) eggfile = StringIO(get_data(__package__, 'mybot.egg')) eggstorage.put(eggfile, 'mybot', 'r1') self.assertEqual(sorted(get_spider_list('mybot')), ['spider1', 'spider2'])
def execute(): config = _get_config() log.startLogging(sys.stderr) application = get_application(config) app.startApplication(application, False) reactor.run()
from scrapyd import get_application from nest.application.website import NestServerFactory from nest.restful.daemonstatus import Instance scrapydApp = get_application() application = NestServerFactory(scrapydApp) \ .addService('hello', Instance) \ .registry()
# this file is used to start scrapyd with twistd -y from scrapyd import get_application application = get_application()