Combine the elements of a tuple as returned by urlsplit() into a complete URL as a string. The data argument can be any five-item iterable. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had unnecessary delimiters (for example, a ? with
(components)
| 548 | query or None, fragment or None)) |
| 549 | |
| 550 | def urlunsplit(components): |
| 551 | """Combine the elements of a tuple as returned by urlsplit() into a |
| 552 | complete URL as a string. The data argument can be any five-item iterable. |
| 553 | This may result in a slightly different, but equivalent URL, if the URL that |
| 554 | was parsed originally had unnecessary delimiters (for example, a ? with an |
| 555 | empty query; the RFC states that these are equivalent).""" |
| 556 | scheme, netloc, url, query, fragment, _coerce_result = ( |
| 557 | _coerce_args(*components)) |
| 558 | if not netloc: |
| 559 | if scheme and scheme in uses_netloc and (not url or url[:1] == '/'): |
| 560 | netloc = '' |
| 561 | else: |
| 562 | netloc = None |
| 563 | return _coerce_result(_urlunsplit(scheme or None, netloc, url, |
| 564 | query or None, fragment or None)) |
| 565 | |
| 566 | def _urlunsplit(scheme, netloc, url, query, fragment): |
| 567 | if netloc is not None: |
no test coverage detected