summaryrefslogtreecommitdiffstats
path: root/Doc/library/urllib.rst
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-20 15:14:11 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-20 15:14:11 (GMT)
commit9bd667ad030913ead3a789f45e73c26f9f28fb46 (patch)
treeea9c145cdcc74d4f1b0b084b083f9286a878c513 /Doc/library/urllib.rst
parent78b11870a4c441e42cf60dca3a6d22f5896311ba (diff)
downloadcpython-9bd667ad030913ead3a789f45e73c26f9f28fb46.zip
cpython-9bd667ad030913ead3a789f45e73c26f9f28fb46.tar.gz
cpython-9bd667ad030913ead3a789f45e73c26f9f28fb46.tar.bz2
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines #1351692: in pprint, always call format() for dict and list items to enable custom formatting of contents via subclassing PrettyPrinter. ........ r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines #1178141: add addinfourl.code to get http status code from urllib. ........ r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines #856047: respect the ``no_proxy`` env var when checking for proxies in urllib and using the other ``_proxy`` env vars. Original patch by Donovan Baarda. ........ r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines #1664522: in urllib, don't read non-existing directories in ftp mode, returning a 0-byte file -- raise an IOError instead. Original patch from Phil Knirsch. ........ r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines #799369: document possible sys.platform values. ........ r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines #652749: document the constants added to the builtins by site.py. ........ r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines #1648: add sys.gettrace() and sys.getprofile(). ........ r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines #1669: don't allow shutil.rmtree() to be called on a symlink. ........ r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines Fix test_pyclbr after urllib change. ........ r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :) ........ r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines #1876: fix typos in test_operator. ........
Diffstat (limited to 'Doc/library/urllib.rst')
-rw-r--r--Doc/library/urllib.rst19
1 files changed, 14 insertions, 5 deletions
diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst
index 4b86e88..63fb53e 100644
--- a/Doc/library/urllib.rst
+++ b/Doc/library/urllib.rst
@@ -27,16 +27,17 @@ High-level interface
a server somewhere on the network. If the connection cannot be made the
:exc:`IOError` exception is raised. If all went well, a file-like object is
returned. This supports the following methods: :meth:`read`, :meth:`readline`,
- :meth:`readlines`, :meth:`fileno`, :meth:`close`, :meth:`info` and
+ :meth:`readlines`, :meth:`fileno`, :meth:`close`, :meth:`info`, :meth:`getcode` and
:meth:`geturl`. It also has proper support for the :term:`iterator` protocol. One
caveat: the :meth:`read` method, if the size argument is omitted or negative,
may not read until the end of the data stream; there is no good way to determine
that the entire stream from a socket has been read in the general case.
- Except for the :meth:`info` and :meth:`geturl` methods, these methods have the
- same interface as for file objects --- see section :ref:`bltin-file-objects` in
- this manual. (It is not a built-in file object, however, so it can't be used at
- those few places where a true built-in file object is required.)
+ Except for the :meth:`info`, :meth:`getcode` and :meth:`geturl` methods,
+ these methods have the same interface as for file objects --- see section
+ :ref:`bltin-file-objects` in this manual. (It is not a built-in file object,
+ however, so it can't be used at those few places where a true built-in file
+ object is required.)
.. index:: module: mimetools
@@ -58,6 +59,9 @@ High-level interface
the client was redirected to. The :meth:`geturl` method can be used to get at
this redirected URL.
+ The :meth:`getcode` method returns the HTTP status code that was sent with the
+ response, or ``None`` if the URL is no HTTP URL.
+
If the *url* uses the :file:`http:` scheme identifier, the optional *data*
argument may be given to specify a ``POST`` request (normally the request type
is ``GET``). The *data* argument must be in standard
@@ -75,6 +79,11 @@ High-level interface
% python
...
+ The :envvar:`no_proxy` environment variable can be used to specify hosts which
+ shouldn't be reached via proxy; if set, it should be a comma-separated list
+ of hostname suffixes, optionally with ``:port`` appended, for example
+ ``cern.ch,ncsa.uiuc.edu,some.host:8080``.
+
In a Windows environment, if no proxy environment variables are set, proxy
settings are obtained from the registry's Internet Settings section.