예제 #1
0
파일: script.py 프로젝트: huangpanxx/POAS
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
예제 #2
0
def execute():
    try:
        config = _get_config()
    except NotConfigured:
        config = None
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()
예제 #3
0
파일: script.py 프로젝트: AllenCHM/scrapyd
def execute():
    try:
        config = _get_config()
    except NotConfigured:
        config = None
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()
예제 #4
0
 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()
예제 #5
0
 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()
예제 #6
0
파일: runner.py 프로젝트: jdb613/tracking
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)
예제 #7
0
 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'])
예제 #8
0
 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'])
예제 #9
0
def execute():
    config = _get_config()
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()
예제 #10
0
파일: app.py 프로젝트: octacon/zerg-nest
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()
예제 #11
0
# this file is used to start scrapyd with twistd -y
from scrapyd import get_application
application = get_application()
예제 #12
0
def execute():
    config = _get_config()
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()