MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / urlparse

Function urlparse

tools/python-3.11.9-amd64/Lib/urllib/parse.py:374–402  ·  view source on GitHub ↗

Parse a URL into 6 components: :// / ; ? # The result is a named 6-tuple with fields corresponding to the above. It is either a ParseResult or ParseResultBytes object, depending on the type of the url parameter. The username, pa

(url, scheme='', allow_fragments=True)

Source from the content-addressed store, hash-verified

372del _fix_result_transcoding
373
374def urlparse(url, scheme='', allow_fragments=True):
375 """Parse a URL into 6 components:
376 <scheme>://<netloc>/<path>;<params>?<query>#<fragment>
377
378 The result is a named 6-tuple with fields corresponding to the
379 above. It is either a ParseResult or ParseResultBytes object,
380 depending on the type of the url parameter.
381
382 The username, password, hostname, and port sub-components of netloc
383 can also be accessed as attributes of the returned object.
384
385 The scheme argument provides the default value of the scheme
386 component when no scheme is found in url.
387
388 If allow_fragments is False, no attempt is made to separate the
389 fragment component from the previous component, which can be either
390 path or query.
391
392 Note that % escapes are not expanded.
393 """
394 url, scheme, _coerce_result = _coerce_args(url, scheme)
395 splitresult = urlsplit(url, scheme, allow_fragments)
396 scheme, netloc, url, query, fragment = splitresult
397 if scheme in uses_params and ';' in url:
398 url, params = _splitparams(url)
399 else:
400 params = ''
401 result = ParseResult(scheme, netloc, url, params, query, fragment)
402 return _coerce_result(result)
403
404def _splitparams(url):
405 if '/' in url:

Callers 15

upload_fileMethod · 0.90
request_hostFunction · 0.90
http_error_302Method · 0.90
http_error_401Method · 0.90
redirect_internalMethod · 0.90
upload_fileMethod · 0.90
urlFunction · 0.90
urljoinFunction · 0.85
urldefragFunction · 0.85
build_digest_headerMethod · 0.85
get_netrc_authFunction · 0.85
should_bypass_proxiesFunction · 0.85

Calls 4

_coerce_argsFunction · 0.85
urlsplitFunction · 0.85
_splitparamsFunction · 0.85
ParseResultClass · 0.85

Tested by

no test coverage detected