@@ -366,9 +366,23 @@ def _fix_result_transcoding():
366
366
def urlparse (url , scheme = '' , allow_fragments = True ):
367
367
"""Parse a URL into 6 components:
368
368
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
369
- Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
370
- Note that we don't break the components up in smaller bits
371
- (e.g. netloc is a single string) and we don't expand % escapes."""
369
+
370
+ The result is a named 6-tuple with fields corresponding to the
371
+ above. It is either a ParseResult or ParseResultBytes object,
372
+ depending on the type of the url parameter.
373
+
374
+ The username, password, hostname, and port sub-components of netloc
375
+ can also be accessed as attributes of the returned object.
376
+
377
+ The scheme argument provides the default value of the scheme
378
+ component when no scheme is found in url.
379
+
380
+ If allow_fragments is False, no attempt is made to separate the
381
+ fragment component from the previous component, which can be either
382
+ path or query.
383
+
384
+ Note that % escapes are not expanded.
385
+ """
372
386
url , scheme , _coerce_result = _coerce_args (url , scheme )
373
387
splitresult = urlsplit (url , scheme , allow_fragments )
374
388
scheme , netloc , url , query , fragment = splitresult
@@ -417,9 +431,24 @@ def _checknetloc(netloc):
417
431
def urlsplit (url , scheme = '' , allow_fragments = True ):
418
432
"""Parse a URL into 5 components:
419
433
<scheme>://<netloc>/<path>?<query>#<fragment>
420
- Return a 5-tuple: (scheme, netloc, path, query, fragment).
421
- Note that we don't break the components up in smaller bits
422
- (e.g. netloc is a single string) and we don't expand % escapes."""
434
+
435
+ The result is a named 5-tuple with fields corresponding to the
436
+ above. It is either a SplitResult or SplitResultBytes object,
437
+ depending on the type of the url parameter.
438
+
439
+ The username, password, hostname, and port sub-components of netloc
440
+ can also be accessed as attributes of the returned object.
441
+
442
+ The scheme argument provides the default value of the scheme
443
+ component when no scheme is found in url.
444
+
445
+ If allow_fragments is False, no attempt is made to separate the
446
+ fragment component from the previous component, which can be either
447
+ path or query.
448
+
449
+ Note that % escapes are not expanded.
450
+ """
451
+
423
452
url , scheme , _coerce_result = _coerce_args (url , scheme )
424
453
allow_fragments = bool (allow_fragments )
425
454
key = url , scheme , allow_fragments , type (url ), type (scheme )
0 commit comments