diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-07-02 01:57:08 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-07-02 01:57:08 (GMT) |
commit | 8bb8fa5dd679d1f4086fac4d3181f0985c14006d (patch) | |
tree | d42673a3deb34bb5c03202b979b766eb89bb20a2 /Lib/urllib.py | |
parent | aac51b8a69d65533f511f0483c797fcf6a6c696c (diff) | |
download | cpython-8bb8fa5dd679d1f4086fac4d3181f0985c14006d.zip cpython-8bb8fa5dd679d1f4086fac4d3181f0985c14006d.tar.gz cpython-8bb8fa5dd679d1f4086fac4d3181f0985c14006d.tar.bz2 |
Handle urllib's renaming for Python 3.0:
* Deprecate urllib.urlopen() in favor of urllib2.urlopen() for 3.0.
* Update docs to mention split/rename of the module and deprecation of
urlopen().
Changes to lib2to3 are in a separate commit. Work is for issue #2885.
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r-- | Lib/urllib.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index ab22a95..55a29f4 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -28,6 +28,7 @@ import os import time import sys from urlparse import urljoin as basejoin +import warnings __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", @@ -69,7 +70,11 @@ else: # Shortcut for basic usage _urlopener = None def urlopen(url, data=None, proxies=None): - """urlopen(url [, data]) -> open file-like object""" + """Create a file-like object for the specified URL to read from.""" + from warnings import warnpy3k + warnings.warnpy3k("urllib.urlopen() has been removed in Python 3.0 in " + "favor of urllib2.urlopen()", stacklevel=2) + global _urlopener if proxies is not None: opener = FancyURLopener(proxies=proxies) |