예제 #1
0
    def test_is_url(self):
        self.assertTrue(is_url('http://github.com'))
        self.assertTrue(is_url('https://github.com/'))
        self.assertTrue(is_url('file://localhost/etc/fstab'))

        self.assertFalse(is_url('github.com'))
        self.assertFalse(is_url('/etc/conf'))
예제 #2
0
    def test_is_url(self):
        self.assertTrue(is_url('http://github.com'))
        self.assertTrue(is_url('https://github.com/'))
        self.assertTrue(is_url('file://localhost/etc/fstab'))

        self.assertFalse(is_url('github.com'))
        self.assertFalse(is_url('/etc/conf'))
예제 #3
0
파일: base.py 프로젝트: Mimino666/crawlmi
 def get_spider(self, engine, args, options):
     spiders = engine.spiders
     if getattr(options, 'spider', None):
         return spiders.create_spider_by_name(options.spider)
     if len(args) == 1 and is_url(args[0]):
         spider = spiders.create_spider_by_url(args[0])
         if spider:
             return spider
     return BaseSpider('default')
예제 #4
0
 def get_spider(self, engine, args, options):
     spiders = engine.spiders
     if getattr(options, 'spider', None):
         return spiders.create_spider_by_name(options.spider)
     if len(args) == 1 and is_url(args[0]):
         spider = spiders.create_spider_by_url(args[0])
         if spider:
             return spider
     return BaseSpider('default')