MCPcopy Create free account
hub / github.com/cxapython/catvm / process_response

Method process_response

selenium/scrapy_splash/middleware.py:367–397  ·  view source on GitHub ↗
(self, request, response, spider)

Source from the content-addressed store, hash-verified

365 return new_request
366
367 def process_response(self, request, response, spider):
368 if not request.meta.get("_splash_processed"):
369 return response
370
371 splash_options = request.meta['splash']
372 if not splash_options:
373 return response
374
375 # update stats
376 endpoint = splash_options['endpoint']
377 self.crawler.stats.inc_value(
378 'splash/%s/response_count/%s' % (endpoint, response.status)
379 )
380
381 # handle save_args/load_args
382 self._process_x_splash_saved_arguments(request, response)
383 if get_splash_status(response) == 498:
384 logger.debug("Got HTTP 498 response for {}; "
385 "sending arguments again.".format(request),
386 extra={'spider': spider})
387 return self._498_retry_request(request, response)
388
389 if splash_options.get('dont_process_response', False):
390 return response
391
392 response = self._change_response_class(request, response)
393
394 if self.log_400 and get_splash_status(response) == 400:
395 self._log_400(request, response, spider)
396
397 return response
398
399 def _change_response_class(self, request, response):
400 from scrapy_splash import SplashResponse, SplashTextResponse

Callers

nothing calls this directly

Calls 5

_498_retry_requestMethod · 0.95
_log_400Method · 0.95
get_splash_statusFunction · 0.90

Tested by

no test coverage detected