settings.py 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. # -*- coding: utf-8 -*-
  2. # Scrapy settings for hg3535 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. # https://doc.scrapy.org/en/latest/topics/settings.html
  8. # https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
  9. # https://doc.scrapy.org/en/latest/topics/spider-middleware.html
  10. BOT_NAME = 'hg3535'
  11. SPIDER_MODULES = ['hg3535.spiders']
  12. NEWSPIDER_MODULE = 'hg3535.spiders'
  13. # Crawl responsibly by identifying yourself (and your website) on the user-agent
  14. USER_AGENT = {
  15. 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20120813 Firefox/16.0'
  16. }
  17. # Obey robots.txt rules
  18. ROBOTSTXT_OBEY = False
  19. # Configure maximum concurrent requests performed by Scrapy (default: 16)
  20. CONCURRENT_REQUESTS = 16
  21. # Configure a delay for requests for the same website (default: 0)
  22. # See https://doc.scrapy.org/en/latest/topics/settings.html#download-delay
  23. # See also autothrottle settings and docs
  24. # DOWNLOAD_DELAY = 3
  25. DOWNLOAD_DELAY = 0
  26. # The download delay setting will honor only one of:
  27. CONCURRENT_REQUESTS_PER_DOMAIN = 16
  28. CONCURRENT_REQUESTS_PER_IP = 0
  29. # Disable cookies (enabled by default)
  30. # COOKIES_ENABLED = False
  31. # Disable Telnet Console (enabled by default)
  32. # TELNETCONSOLE_ENABLED = False
  33. # Override the default request headers:
  34. # DEFAULT_REQUEST_HEADERS = {
  35. # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  36. # 'Accept-Language': 'en',
  37. # }
  38. # Enable or disable spider middlewares
  39. # See https://doc.scrapy.org/en/latest/topics/spider-middleware.html
  40. # from scrapy_deltafetch
  41. # SPIDER_MIDDLEWARES = {
  42. # # 'scrapy_deltafetch.DeltaFetch': 100,
  43. # 'hg3535.middlewares.Hg3535SpiderMiddleware': 543
  44. # }
  45. # #
  46. # DELTAFETCH_ENABLED = True
  47. # Enable or disable downloader middlewares
  48. # See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
  49. DOWNLOADER_MIDDLEWARES = {
  50. # 'hg3535.middlewares.Hg3535DownloaderMiddleware': 200,
  51. 'hg3535.middlewares.Hg3535timeoutDownloaderMiddleware': 200,
  52. 'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware': 500,
  53. # 'scrapy.contrib.downloadermiddleware.retry.RetryMiddleware': 502,
  54. }
  55. # Enable or disable extensions
  56. # See https://doc.scrapy.org/en/latest/topics/extensions.html
  57. # EXTENSIONS = {
  58. # 'scrapy.extensions.telnet.TelnetConsole': None,
  59. # }
  60. # Configure item pipeline
  61. # See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
  62. ITEM_PIPELINES = {
  63. # 'scrapy_redis.pipelines.RedisPipeline': 400,
  64. # # 篮球
  65. # 'hg3535.pipeline.Lanqiupipeline': 300,
  66. # # 冠军
  67. # 'hg3535.pipeline.Guanjunpipeline': 300,
  68. # # 联赛
  69. # 'hg3535.pipeline.Liansaipipeline': 300,
  70. # # 足球
  71. # 'hg3535.pipeline.Zuqiupipeline': 300,
  72. # # 网球
  73. # "hg3535.pipeline.Wangqiupipeline": 300,
  74. # # 网球波胆
  75. # 'hg3535.pipeline.Wqbodanpipeline': 300,
  76. # # 棒球让球&大小盘
  77. # "hg3535.pipeline.Bangqiupipeline": 300,
  78. }
  79. # Enable and configure the AutoThrottle extension (disabled by default)
  80. # See https://doc.scrapy.org/en/latest/topics/autothrottle.html
  81. # AUTOTHROTTLE_ENABLED = True
  82. # The initial download delay
  83. # AUTOTHROTTLE_START_DELAY = 5
  84. # The maximum download delay to be set in case of high latencies
  85. # AUTOTHROTTLE_MAX_DELAY = 60
  86. # The average number of requests Scrapy should be sending in parallel to
  87. # each remote server
  88. # AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
  89. # Enable showing throttling stats for every response received:
  90. # AUTOTHROTTLE_DEBUG = False
  91. # Enable and configure HTTP caching (disabled by default)
  92. # See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
  93. # HTTPCACHE_ENABLED = True
  94. # HTTPCACHE_EXPIRATION_SECS = 0
  95. # HTTPCACHE_DIR = 'httpcache'
  96. # HTTPCACHE_IGNORE_HTTP_CODES = []
  97. # HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
  98. # DOWNLOAD_TIMEOUT = 180
  99. REACTOR_THREADPOOL_MAXSIZE = 40
  100. # LOG_LEVEL = 'INFO'
  101. COOKIES_ENABLED = False
  102. RETRY_ENABLED = False
  103. DOWNLOAD_TIMEOUT = 10
  104. REDIRECT_ENABLED = False
  105. CONCURRENT_ITEMS = 1000
  106. # SCHEDULER_PERSIST = False # 是否在关闭时候保留原来的调度器和去重记录,True=保留,False=清空
  107. # SCHEDULER_FLUSH_ON_START = False
  108. # TELNETCONSOLE_PORT = None
  109. # TELNETCONSOLE_ENABLED=False
  110. # AttributeError: 'TelnetConsole' object has no attribute 'port'
  111. # RETRY_ENABLED = True
  112. # RETRY_TIMES = 2
  113. # RETRY_HTTP_CODES = [500, 502, 503, 504, 400, 408]
  114. # LOG_LEVEL = 'DEBUG'
  115. # SCHEDULER_PERSIST = False
  116. # LOG_FILE = './log/'
  117. M_HOST = '192.168.2.200'
  118. # M_HOST = '127.0.0.1'
  119. M_POST = 27017
  120. M_USER = 'kaiyou'
  121. M_DB = 'kaiyou'
  122. M_PASSWORD = 'kaiyou'
  123. # M_PASSWORD = '123456'
  124. LEAGUE_URL = 'http://stadmin.bocai108.com:19093/setLeague'
  125. MATCH_URL = 'http://stadmin.bocai108.com:19093/setMatch'
  126. ODDS_URL = 'http://stadmin.bocai108.com:19093/setOdds'
  127. # ODDS_URL = 'http://stadmin.bocai108.com/setOdds'
  128. TOKEN_URL = "http://stadmin.bocai108.com/getToken"
  129. MATCH_RESULT = "http://stadmin.bocai108.com:19093/setMatchResult"
  130. MATCH_STATUS = "http://stadmin.bocai108.com:19093/upMatch"
  131. ODDSCH = "http://stadmin.bocai108.com:19093/setOddsCH"
  132. R_HOST = '192.168.2.200'
  133. R_POST = 6379
  134. R_DB = 1
  135. R_PASSWORD = 123456
  136. #upMatch
  137. # POST_HOST = 'localhost'
  138. # POST_DATABASE = 'kaiyou'
  139. # POST_USER = 'kaiyou'
  140. # POST_PORT = '10432'
  141. # POST_PASSWORD = '123456'
  142. # SCHEDULER = "scrapy_redis.scheduler.Scheduler"
  143. # DUPEFILTER_CLASS = "scrapy_redis.dupefilter.RFPDupeFilter"
  144. # SCHEDULER_SERIALIZER = "scrapy_redis.picklecompat"
  145. # #不要清理redis队列,允许暂停/恢复抓取。
  146. # SCHEDULER_PERSIST = False
  147. # #使用优先级队列安排请求。(默认)
  148. # SCHEDULER_QUEUE_CLASS = 'scrapy_redis.queue.PriorityQueue'
  149. # REDIS_HOST = '192.168.2.200'
  150. # REDIS_PORT = 6379
  151. # REDIS_PARAMS = {'password': 123456, 'db': 1}
  152. # 随机等待
  153. # RANDOMIZE_DOWNLOAD_DELAY = True
  154. # # AutoThrottle扩展
  155. # AUTOTHROTTLE_ENABLED = True
  156. # AUTOTHROTTLE_DEBUG = True
  157. # AUTOTHROTTLE_TARGET_CONCURRENCY = 0.25
  158. # AUTOTHROTTLE_MAX_DELAY = 5
  159. # SCHEDULER = "scrapy_redis.scheduler.Scheduler"
  160. # DUPEFILTER_CLASS = "scrapy_redis.dupefilter.RFPDupeFilter"
  161. # REDIS_URL = 'redis://:123456@192.168.2.200:6379'
  162. # SCHEDULER_PERSIST = False