2017-09-15 97 views
-1

我運行了一個蜘蛛並得到了以下日誌中的416錯誤。請有誰能幫我弄清楚是什麼問題?Scrapy錯誤 - 未處理或不允許HTTP狀態代碼

2017-09-15 17:05:45 [scrapy] INFO: Scrapy 1.0.3 started (bot: apa) 
2017-09-15 17:05:45 [scrapy] INFO: Optional features available: ssl, http11, boto 
2017-09-15 17:05:45 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'apa.spiders', 'FEED_FORMAT': 'xml', 'SPIDER_MODULES': ['apa.spiders'], 'FEED_URI': 'testex.xml', 'BOT_NAME': 'apa'} 
2017-09-15 17:05:45 [scrapy] INFO: Enabled extensions: CloseSpider, FeedExporter, TelnetConsole, LogStats, CoreStats, SpiderState 
2017-09-15 17:05:45 [scrapy] INFO: Enabled downloader middlewares: HttpAuthMiddleware, DownloadTimeoutMiddleware, RetryMiddleware, DefaultHeadersMiddleware, MetaRefreshMiddleware, HttpCompressionMiddleware, RedirectMiddleware, CookiesMiddleware, ChunkedTransferMiddleware, DownloaderStats 
2017-09-15 17:05:45 [scrapy] INFO: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, ``UrlLengthMiddleware, DepthMiddleware 
2017-09-15 17:05:45 [scrapy] INFO: Enabled item pipelines: 
2017-09-15 17:05:45 [scrapy] INFO: Spider opened 
2017-09-15 17:05:45 [scrapy] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min) 
2017-09-15 17:05:45 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6023 
2017-09-15 17:05:46 [scrapy] DEBUG: Crawled (416) <GET http://www.apa.org/research/action/aging.aspx> (referer: None) 
2017-09-15 17:05:46 [scrapy] DEBUG: Ignoring response <416 http://www.apa.org/research/action/aging.aspx>: HTTP status code is not handled or not allowed 
2017-09-15 17:05:46 [scrapy] INFO: Closing spider (finished) 
2017-09-15 17:05:46 [scrapy] INFO: Dumping Scrapy stats: 
{'downloader/request_bytes': 188, 
'downloader/request_count': 1, 
'downloader/request_method_count/GET': 1, 
'downloader/response_bytes': 1857, 
'downloader/response_count': 1, 
'downloader/response_status_count/416': 1, 
'finish_reason': 'finished', 
'finish_time': datetime.datetime(2017, 9, 15, 11, 35, 46, 706598), 
'log_count/DEBUG': 3, 
'log_count/INFO': 7, 
'response_received_count': 1, 
'scheduler/dequeued': 1, 
'scheduler/dequeued/memory': 1, 
'scheduler/enqueued': 1, 
'scheduler/enqueued/memory': 1, 
'start_time': datetime.datetime(2017, 9, 15, 11, 35, 45, 987587)} 
2017-09-15 17:05:46 [scrapy] INFO: Spider closed (finished) 
+0

還可以顯示 '蜘蛛' 用這個

class ApaSpider(CrawlSpider): handle_httpstatus_list = [416] 

集? – SteveFest

回答

0

您可以在請求

meta = {'handle_httpstatus_list': [416]}