module documentation

This module provides some useful functions for working with scrapy.http.Response objects
Function get​_base​_url Return the base url of the given response, joined with the response url
Function get​_meta​_refresh Parse the http-equiv refrsh parameter from the given response
Function open​_in​_browser Open the given response in a local web browser, populating the <base> tag for external links to work
Function response​_httprepr Return raw HTTP representation (as bytes) of the given response. This is provided only for reference, since it's not the exact stream of bytes that was received (that's not exposed by Twisted).
Function response​_status​_message Return status code plus status text descriptive message
Variable ​_baseurl​_cache Undocumented
Variable ​_metaref​_cache Undocumented
def get_base_url(response):
Return the base url of the given response, joined with the response url
Parameters
response:scrapy.http.response.text.TextResponseUndocumented
Returns
strUndocumented
def get_meta_refresh(response, ignore_tags=('script', 'noscript')):
Parse the http-equiv refrsh parameter from the given response
Parameters
response:scrapy.http.response.text.TextResponseUndocumented
ignore​_tags:Optional[Iterable[str]]Undocumented
Returns
Union[Tuple[None, None], Tuple[float, str]]Undocumented
def open_in_browser(response, _openfunc=webbrowser.open):
Open the given response in a local web browser, populating the <base> tag for external links to work
Parameters
response:Union[scrapy.http.response.html.HtmlResponse, scrapy.http.response.text.TextResponse]Undocumented
​_openfunc:Callable[[str], Any]Undocumented
Returns
AnyUndocumented
def response_httprepr(response):
Return raw HTTP representation (as bytes) of the given response. This is provided only for reference, since it's not the exact stream of bytes that was received (that's not exposed by Twisted).
Parameters
response:ResponseUndocumented
Returns
bytesUndocumented
def response_status_message(status):
Return status code plus status text descriptive message
Parameters
status:Union[bytes, float, int, str]Undocumented
Returns
strUndocumented
_baseurl_cache: WeakKeyDictionary[Response, str] =

Undocumented

_metaref_cache: WeakKeyDictionary[Response, Union[Tuple[None, None], Tuple[float, str]]] =

Undocumented