Created
September 5, 2014 19:10
-
-
Save nramirezuy/e75d8c041b07a8edb44f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scrapy.spider import Spider | |
from scrapy import log | |
class DummySpider(Spider): | |
name = "dummy" | |
allowed_domains = ["example.com", "iana.org"] | |
start_urls = ( | |
'http://www.example.com/', | |
) | |
def __init__(self, *args, **kwargs): | |
super(DummySpider, self).__init__(*args, **kwargs) | |
def parse(self, response): | |
log.msg('DEBUG', level=log.DEBUG) | |
log.msg('INFO', level=log.INFO) | |
log.msg('WARNING', level=log.WARNING) | |
log.msg('ERROR', level=log.ERROR) | |
log.msg('CRITICAL', level=log.CRITICAL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ scrapy crawl dummy | |
2014-09-05 16:08:56-0300 [dummy] INFO: Spider opened | |
2014-09-05 16:08:56-0300 [dummy] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min) | |
2014-09-05 16:08:56-0300 [scrapy] INFO: Scrapy 0.25.1 started (bot: testspiders) | |
2014-09-05 16:08:56-0300 [scrapy] INFO: Optional features available: ssl, http11, boto | |
2014-09-05 16:08:56-0300 [scrapy] INFO: Overridden settings: {'CLOSESPIDER_TIMEOUT': 3600, 'CLOSESPIDER_PAGECOUNT': 1000, 'SPIDER_MODULES': ['testspiders.spiders'], 'NEWSPIDER_MODULE': 'testspiders.spiders', 'BOT_NAME': 'testspiders'} | |
2014-09-05 16:08:57-0300 [dummy] DEBUG: Crawled (200) <GET http://www.example.com/> (referer: None) | |
2014-09-05 16:08:57-0300 [scrapy] DEBUG: DEBUG | |
2014-09-05 16:08:57-0300 [scrapy] INFO: INFO | |
2014-09-05 16:08:57-0300 [scrapy] WARNING: WARNING | |
2014-09-05 16:08:57-0300 [scrapy] ERROR: ERROR | |
2014-09-05 16:08:57-0300 [scrapy] CRITICAL: CRITICAL | |
2014-09-05 16:08:57-0300 [dummy] INFO: Closing spider (finished) | |
2014-09-05 16:08:57-0300 [dummy] INFO: Dumping Scrapy stats: | |
{'downloader/request_bytes': 214, | |
'downloader/request_count': 1, | |
'downloader/request_method_count/GET': 1, | |
'downloader/response_bytes': 1569, | |
'downloader/response_count': 1, | |
'downloader/response_status_count/200': 1, | |
'finish_reason': 'finished', | |
'finish_time': datetime.datetime(2014, 9, 5, 19, 8, 57, 54845), | |
'log_count/DEBUG': 1, | |
'log_count/INFO': 3, | |
'response_received_count': 1, | |
'scheduler/dequeued': 1, | |
'scheduler/dequeued/memory': 1, | |
'scheduler/enqueued': 1, | |
'scheduler/enqueued/memory': 1, | |
'start_time': datetime.datetime(2014, 9, 5, 19, 8, 56, 576870)} | |
2014-09-05 16:08:57-0300 [dummy] INFO: Spider closed (finished) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ scrapy crawl dummy -s LOG_LEVEL=WARNING | |
2014-09-05 16:09:46-0300 [scrapy] WARNING: WARNING | |
2014-09-05 16:09:46-0300 [scrapy] ERROR: ERROR | |
2014-09-05 16:09:46-0300 [scrapy] CRITICAL: CRITICAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ scrapy crawl dummy -s LOG_LEVEL=INFO | |
2014-09-05 16:10:23-0300 [dummy] INFO: Spider opened | |
2014-09-05 16:10:23-0300 [dummy] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min) | |
2014-09-05 16:10:23-0300 [scrapy] INFO: Scrapy 0.25.1 started (bot: testspiders) | |
2014-09-05 16:10:23-0300 [scrapy] INFO: Optional features available: ssl, http11, boto | |
2014-09-05 16:10:23-0300 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'testspiders.spiders', 'LOG_LEVEL': 'INFO', 'SPIDER_MODULES': ['testspiders.spiders'], 'BOT_NAME': 'testspiders', 'CLOSESPIDER_TIMEOUT': 3600, 'CLOSESPIDER_PAGECOUNT': 1000} | |
2014-09-05 16:10:23-0300 [scrapy] INFO: INFO | |
2014-09-05 16:10:23-0300 [scrapy] WARNING: WARNING | |
2014-09-05 16:10:23-0300 [scrapy] ERROR: ERROR | |
2014-09-05 16:10:23-0300 [scrapy] CRITICAL: CRITICAL | |
2014-09-05 16:10:23-0300 [dummy] INFO: Closing spider (finished) | |
2014-09-05 16:10:23-0300 [dummy] INFO: Dumping Scrapy stats: | |
{'downloader/request_bytes': 214, | |
'downloader/request_count': 1, | |
'downloader/request_method_count/GET': 1, | |
'downloader/response_bytes': 1569, | |
'downloader/response_count': 1, | |
'downloader/response_status_count/200': 1, | |
'finish_reason': 'finished', | |
'finish_time': datetime.datetime(2014, 9, 5, 19, 10, 23, 921165), | |
'log_count/INFO': 3, | |
'response_received_count': 1, | |
'scheduler/dequeued': 1, | |
'scheduler/dequeued/memory': 1, | |
'scheduler/enqueued': 1, | |
'scheduler/enqueued/memory': 1, | |
'start_time': datetime.datetime(2014, 9, 5, 19, 10, 23, 166550)} | |
2014-09-05 16:10:23-0300 [dummy] INFO: Spider closed (finished) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment