Esempio n. 1
0
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
Esempio n. 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()
Esempio n. 3
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()
Esempio n. 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()
Esempio n. 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()
Esempio n. 6
0
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)
Esempio n. 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'])
Esempio n. 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'])
Esempio n. 9
0
def execute():
    config = _get_config()
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()
Esempio n. 10
0
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()
Esempio n. 11
0
# this file is used to start scrapyd with twistd -y
from scrapyd import get_application
application = get_application()
Esempio n. 12
0
def execute():
    config = _get_config()
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()