MCPcopy
hub / github.com/scrapy/scrapy / url_has_any_extension

Function url_has_any_extension

scrapy/utils/url.py:41–44  ·  view source on GitHub ↗

Return True if the url ends with one of the extensions provided

(url: UrlT, extensions: Iterable[str])

Source from the content-addressed store, hash-verified

39
40
41def url_has_any_extension(url: UrlT, extensions: Iterable[str]) -> bool:
42 """Return True if the url ends with one of the extensions provided"""
43 lowercase_path = parse_url(url).path.lower()
44 return any(lowercase_path.endswith(ext) for ext in extensions)
45
46
47def add_http_if_no_scheme(url: str) -> str:

Callers 2

_link_allowedMethod · 0.90

Calls

no outgoing calls

Tested by 1