|
8 | 8 | import posixpath |
9 | 9 | import re |
10 | 10 | import string |
11 | | -import warnings |
12 | 11 | from collections import namedtuple |
13 | 12 | from urllib.parse import ( |
14 | 13 | _coerce_args, |
|
19 | 18 | unquote_to_bytes, |
20 | 19 | urldefrag, |
21 | 20 | urlencode, |
22 | | - urljoin, |
23 | 21 | urlparse, |
24 | 22 | urlsplit, |
25 | 23 | urlunparse, |
@@ -392,21 +390,20 @@ def parse_data_uri(uri): |
392 | 390 | return _ParseDataURIResult(media_type, media_type_params, data) |
393 | 391 |
|
394 | 392 |
|
395 | | -__all__ = ["add_or_replace_parameter", |
396 | | - "add_or_replace_parameters", |
397 | | - "any_to_uri", |
398 | | - "canonicalize_url", |
399 | | - "file_uri_to_path", |
400 | | - "is_url", |
401 | | - "parse_data_uri", |
402 | | - "path_to_file_uri", |
403 | | - "safe_download_url", |
404 | | - "safe_url_string", |
405 | | - "url_query_cleaner", |
406 | | - "url_query_parameter", |
407 | | - |
408 | | - # this last one is deprecated ; include it to be on the safe side |
409 | | - "urljoin_rfc"] |
| 393 | +__all__ = [ |
| 394 | + "add_or_replace_parameter", |
| 395 | + "add_or_replace_parameters", |
| 396 | + "any_to_uri", |
| 397 | + "canonicalize_url", |
| 398 | + "file_uri_to_path", |
| 399 | + "is_url", |
| 400 | + "parse_data_uri", |
| 401 | + "path_to_file_uri", |
| 402 | + "safe_download_url", |
| 403 | + "safe_url_string", |
| 404 | + "url_query_cleaner", |
| 405 | + "url_query_parameter", |
| 406 | +] |
410 | 407 |
|
411 | 408 |
|
412 | 409 | def _safe_ParseResult(parts, encoding='utf8', path_encoding='utf8'): |
@@ -585,38 +582,3 @@ def parse_qsl_to_bytes(qs, keep_blank_values=False): |
585 | 582 | value = _coerce_result(value) |
586 | 583 | r.append((name, value)) |
587 | 584 | return r |
588 | | - |
589 | | - |
590 | | -def urljoin_rfc(base, ref, encoding='utf-8'): |
591 | | - r""" |
592 | | - .. warning:: |
593 | | -
|
594 | | - This function is deprecated and will be removed in future. |
595 | | - It is not supported with Python 3. |
596 | | - Please use ``urlparse.urljoin`` instead. |
597 | | -
|
598 | | - Same as urlparse.urljoin but supports unicode values in base and ref |
599 | | - parameters (in which case they will be converted to str using the given |
600 | | - encoding). |
601 | | -
|
602 | | - Always returns a str. |
603 | | -
|
604 | | - >>> import w3lib.url |
605 | | - >>> w3lib.url.urljoin_rfc('http://www.example.com/path/index.html', '/otherpath/index2.html') |
606 | | - 'http://www.example.com/otherpath/index2.html' |
607 | | - >>> |
608 | | -
|
609 | | - >>> # Note: the following does not work in Python 3 |
610 | | - >>> w3lib.url.urljoin_rfc(b'http://www.example.com/path/index.html', 'fran\u00e7ais/d\u00e9part.htm') # doctest: +SKIP |
611 | | - 'http://www.example.com/path/fran\xc3\xa7ais/d\xc3\xa9part.htm' |
612 | | - >>> |
613 | | -
|
614 | | -
|
615 | | - """ |
616 | | - |
617 | | - warnings.warn("w3lib.url.urljoin_rfc is deprecated, use urlparse.urljoin instead", |
618 | | - DeprecationWarning) |
619 | | - |
620 | | - str_base = to_bytes(base, encoding) |
621 | | - str_ref = to_bytes(ref, encoding) |
622 | | - return urljoin(str_base, str_ref) |
0 commit comments