MCPcopy
hub / github.com/scrapy/scrapy / urlparse_cached

Function urlparse_cached

scrapy/utils/httpobj.py:18–24  ·  view source on GitHub ↗

Return urlparse.urlparse caching the result, where the argument can be a Request or Response object

(request_or_response: Request | Response)

Source from the content-addressed store, hash-verified

16
17
18def urlparse_cached(request_or_response: Request | Response) -> ParseResult:
19 """Return urlparse.urlparse caching the result, where the argument can be a
20 Request or Response object
21 """
22 if request_or_response not in _urlparse_cache:
23 _urlparse_cache[request_or_response] = urlparse(request_or_response.url)
24 return _urlparse_cache[request_or_response]

Callers 15

request_httpreprFunction · 0.90
add_cookie_headerMethod · 0.90
get_hostMethod · 0.90
get_typeMethod · 0.90
origin_req_hostMethod · 0.90
get_slot_keyMethod · 0.90
download_requestMethod · 0.90
_get_agentMethod · 0.90
connectionMadeMethod · 0.90
download_requestMethod · 0.90
download_requestMethod · 0.90

Calls

no outgoing calls

Tested by 7

get_slot_keyMethod · 0.72
parseMethod · 0.72
test_get_hostMethod · 0.72
test_get_typeMethod · 0.72
test_urlparse_cachedFunction · 0.72