MCPcopy
hub / github.com/scrapy/scrapy / guess_scheme

Function guess_scheme

scrapy/utils/url.py:100–105  ·  view source on GitHub ↗

Add an URL scheme if missing: file:// for filepath-like input or http:// otherwise.

(url: str)

Source from the content-addressed store, hash-verified

98
99
100def guess_scheme(url: str) -> str:
101 """Add an URL scheme if missing: file:// for filepath-like input or
102 http:// otherwise."""
103 if _is_filesystem_path(url):
104 return any_to_uri(url)
105 return add_http_if_no_scheme(url)
106
107
108def strip_url(

Callers 2

runMethod · 0.90
test_guess_schemeFunction · 0.90

Calls 2

_is_filesystem_pathFunction · 0.85
add_http_if_no_schemeFunction · 0.85

Tested by 1

test_guess_schemeFunction · 0.72