MCPcopy
hub / github.com/scrapy/scrapy / get_base_url

Function get_base_url

scrapy/utils/response.py:28–35  ·  view source on GitHub ↗

Return the base url of the given response, joined with the response url

(response: TextResponse)

Source from the content-addressed store, hash-verified

26
27
28def get_base_url(response: TextResponse) -> str:
29 """Return the base url of the given response, joined with the response url"""
30 if response not in _baseurl_cache:
31 text = response.text[0:4096]
32 _baseurl_cache[response] = html.get_base_url(
33 text, response.url, response.encoding
34 )
35 return _baseurl_cache[response]
36
37
38_metaref_cache: WeakKeyDictionary[Response, tuple[None, None] | tuple[float, str]] = (

Callers 6

urljoinMethod · 0.90
extract_linksMethod · 0.90
extract_linksMethod · 0.90
__init__Method · 0.90
test_get_base_urlFunction · 0.90
get_meta_refreshFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_get_base_urlFunction · 0.72