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

Method __init__

selenium/scrapy_splash/response.py:26–49  ·  view source on GitHub ↗
(self, url, *args, **kwargs)

Source from the content-addressed store, hash-verified

24 This mixin fixes response.url and adds response.real_url
25 """
26 def __init__(self, url, *args, **kwargs):
27 real_url = kwargs.pop('real_url', None)
28 if real_url is not None:
29 self.real_url = real_url
30 else:
31 self.real_url = None
32 # FIXME: create a .request @property with a setter?
33 # Scrapy doesn't pass request to Response constructor;
34 # it is worked around in SplashMiddleware.
35 request = kwargs['request']
36 splash_args = self._splash_args(request)
37 _url = splash_args.get('url')
38 if _url is not None:
39 self.real_url = url
40 url = _url
41 self.splash_response_status = kwargs.pop('splash_response_status',
42 None)
43 self.splash_response_headers = kwargs.pop('splash_response_headers',
44 None)
45 super(_SplashResponseMixin, self).__init__(url, *args, **kwargs)
46 if self.splash_response_status is None:
47 self.splash_response_status = self.status
48 if self.splash_response_headers is None:
49 self.splash_response_headers = self.headers.copy()
50
51 def replace(self, *args, **kwargs):
52 """Create a new Response with the same attributes except for those

Callers

nothing calls this directly

Calls 2

_splash_argsMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected