Example #1
0
    def schedule_crawl(self, crawler, spider, schedule):
        with session.begin():
            crawler = session.query(Crawler).filter_by(id=crawler).first()
            spider = session.query(Spider).filter_by(crawler_id=crawler.id, name=spider).first()
            crawl_schedule = CrawlSchedule(spider_id=spider.id, crontab=schedule)

            session.add(crawl_schedule)
Example #2
0
    def add_egg(self, crawler, version, egg_handle):
        with session.begin():
            crawler = session.query(Crawler).filter_by(id=crawler).first()
            crawler.egg = egg_handle.read()
            crawler.version = version

            session.add(crawler)
Example #3
0
 def get_crawler(self, crawler_id):
     with session.begin():
         return session.query(Crawler).filter_by(id=crawler_id).first()