settings.py 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # -*- coding: utf-8 -*-
  2. # Scrapy settings for shlib project
  3. #
  4. # For simplicity, this file contains only settings considered important or
  5. # commonly used. You can find more settings consulting the documentation:
  6. #
  7. # http://doc.scrapy.org/en/latest/topics/settings.html
  8. # http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
  9. # http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
  10. BOT_NAME = 'shlib'
  11. SPIDER_MODULES = ['shlib.spiders']
  12. NEWSPIDER_MODULE = 'shlib.spiders'
  13. # 数据库连接参数
  14. DBKWARGS={'db':'ippool','user':'root', 'passwd':'toor',
  15. 'host':'localhost','use_unicode':True, 'charset':'utf8'}
  16. # Crawl responsibly by identifying yourself (and your website) on the user-agent
  17. USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
  18. # Obey robots.txt rules
  19. ROBOTSTXT_OBEY = True
  20. LOG_FILE = "shlib.log"
  21. # Configure maximum concurrent requests performed by Scrapy (default: 16)
  22. #CONCURRENT_REQUESTS = 32
  23. # Configure a delay for requests for the same website (default: 0)
  24. # See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
  25. # See also autothrottle settings and docs
  26. #DOWNLOAD_DELAY = 3
  27. # The download delay setting will honor only one of:
  28. #CONCURRENT_REQUESTS_PER_DOMAIN = 16
  29. #CONCURRENT_REQUESTS_PER_IP = 16
  30. # Disable cookies (enabled by default)
  31. #COOKIES_ENABLED = False
  32. # Disable Telnet Console (enabled by default)
  33. #TELNETCONSOLE_ENABLED = False
  34. # Override the default request headers:
  35. #DEFAULT_REQUEST_HEADERS = {
  36. # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  37. # 'Accept-Language': 'en',
  38. #}
  39. # Enable or disable spider middlewares
  40. # See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
  41. #SPIDER_MIDDLEWARES = {
  42. # 'shlib.middlewares.ShlibSpiderMiddleware': 543,
  43. #}
  44. # Enable or disable downloader middlewares
  45. # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
  46. #DOWNLOADER_MIDDLEWARES = {
  47. # 'shlib.middlewares.MyCustomDownloaderMiddleware': 543,
  48. #}
  49. # Enable or disable extensions
  50. # See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
  51. #EXTENSIONS = {
  52. # 'scrapy.extensions.telnet.TelnetConsole': None,
  53. #}
  54. # Configure item pipelines
  55. # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
  56. ITEM_PIPELINES = {
  57. 'shlib.pipelines.ShlibPipeline': 300,
  58. }
  59. # Enable and configure the AutoThrottle extension (disabled by default)
  60. # See http://doc.scrapy.org/en/latest/topics/autothrottle.html
  61. #AUTOTHROTTLE_ENABLED = True
  62. # The initial download delay
  63. #AUTOTHROTTLE_START_DELAY = 5
  64. # The maximum download delay to be set in case of high latencies
  65. #AUTOTHROTTLE_MAX_DELAY = 60
  66. # The average number of requests Scrapy should be sending in parallel to
  67. # each remote server
  68. #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
  69. # Enable showing throttling stats for every response received:
  70. #AUTOTHROTTLE_DEBUG = False
  71. # Enable and configure HTTP caching (disabled by default)
  72. # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
  73. #HTTPCACHE_ENABLED = True
  74. #HTTPCACHE_EXPIRATION_SECS = 0
  75. #HTTPCACHE_DIR = 'httpcache'
  76. #HTTPCACHE_IGNORE_HTTP_CODES = []
  77. #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'